Coder Social home page Coder Social logo

Comments (3)

charleseidsness avatar charleseidsness commented on July 1, 2024

You're right, that could be confusing for people. I think adding a warning would be sufficient, the other two ideas may have unexpected consequences for current users of this library.

Would you be able to create a Pull Request for this one too? If not we can have a look at adding a warning next week.

from adbus.

sth avatar sth commented on July 1, 2024

It turns our even a simple warning would be quite an invasive change.

For the warning to be useful, intentional deletions need to be distinguished from "accidental" deletions. That means there needs to be some close() method or something that will be called when the owner of the Listen is done with it. In Signal that would for example be in remove(), when a listener is removed.

But I suspect that most code currently doesn't explicitly remove the listeners when a Signal goes out of scope. In such a case it is generally not clear if the surrounding code expects the handler function to stop being called or continue to be called. (The actual behaviour that it's called for a while and then stops is probably unexpected for both.)

This problem also applies to anything that might contain a Signal or Listen, like Proxy and even Interface. The only solution I see is to add some close() function to all those objects and require it to be called when the owner is done with it. Calling all those close() functions would of course require a lot of changes in code that uses the library...

from adbus.

charleseidsness avatar charleseidsness commented on July 1, 2024

We wouldn't want to add that, we use this library within our own system software. We are aware of this limitation and keep proxy in scope for as long as we need to receive signals.

Maybe a not in the readme is the best we can do. I'll add one.

from adbus.

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.