Giter Site home page Giter Site logo

Comments (5)

stefvanschie avatar stefvanschie commented on June 15, 2024 1

Let's keep this open for a little longer - if no one uses the current methods, they can go; if people are using them (and want to continue using those instead of the new callX versions) we can just keep them.

from if.

Trigary avatar Trigary commented on June 15, 2024

One counter-argument is that if plugins decide to throw exceptions in these callbacks, they should expect stuff to break. My response is that as long as the intermediate state these interrupts leave the IF library in are non-permanent, non-fatal (eg. they don't matter the next the click event is called), it's fine. But if that's not the case or if code ever gets added that might get badly hit by these uncaught exceptions problems arise. Catching them is a future-proof, guaranteed bug-free solution with little overhead (both code and runtime performance-wise) and you wouldn't have to worry/think about exceptions from callbacks at all in that case.

from if.

stefvanschie avatar stefvanschie commented on June 15, 2024

I'm assuming you then want the listed methods to be transformed into some kind of callX method that automatically takes care of the exception handling? I'm fine with the changes to keep IF in a 'safe' state even if the user makes a Consumer throw an Exception, but I'm not certain if it's necessary to replace the current methods with these new ones or just keep both of them and internally always use the callX version. After all, if the user calls their own exception throwing Consumer retrieved from the getX methods as you listed, that is, at that point, their problem. It depends on if these current methods are actually used by someone I suppose; if no one uses them, no point in keeping them.

from if.

Trigary avatar Trigary commented on June 15, 2024

I'm assuming you then want the listed methods to be transformed into some kind of callX method that automatically takes care of the exception handling?

Yes.

I'm not certain if it's necessary to replace the current methods with these new ones or just keep both of them and internally always use the callX version.

By replacing those getters, safety in the sense of exception handling would be enforced, there would be no way to make mistakes. Granted, this change helps the developers working on or looking at IF's code more than those who are just using it.

After all, if the user calls their own exception throwing Consumer retrieved from the getX methods as you listed, that is, at that point, their problem.

Good counterargument, but as you also said:

It depends on if these current methods are actually used by someone I suppose; if no one uses them, no point in keeping them.

Exactly. I personally don't think it would affect anyone at all, but that's just a wild guess.

from if.

stefvanschie avatar stefvanschie commented on June 15, 2024

I've gone through the dependents of this framework and from what I can find, none of them seem to be making use of the getX methods, so replacing them with their equivalent callX method should be fine.

from if.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.