Giter Site home page Giter Site logo

Comments (8)

dtribble avatar dtribble commented on July 30, 2024

This is a great use. Thanks. Can you post a pointer to the code so that we can try enhancing it with weak ref code? I will be interested in trying the proposed weakref approach and trying it with various weak collection options.

Also, is there anything in the standard or other source of desire/requirement for making a similar cleanup step if the node is just dropped on the floor (e.g., some incidental additional value in triggering the cleanup).

from proposal-weakrefs.

titzer avatar titzer commented on July 30, 2024

+1 to "iterable weak set", as another use case I have heard is implementing the "become" operator in languages like Smalltalk.

Is it possible to change the title of an issue? If so, I suggest adding "iterable weak set" to the title here.

from proposal-weakrefs.

axkibe avatar axkibe commented on July 30, 2024

I got a rather simple other usecase, I've objects representing points in a 2d plane, I like to freeze them and I would like to intern them, so a simple a === b would test them for equality. For this I'd put all the points generated in a weak table with some kind of hash value to test if this object already exists before creating a new one. Similar for objects representing lines or other geometric objects.

from proposal-weakrefs.

domenic avatar domenic commented on July 30, 2024

@dtribble the code is in roughly these locations:

I'm not sure which node you'd be referring to in "is there anything in the standard or other source of desire/requirement for making a similar cleanup step if the node is just dropped on the floor", but I don't think there is any such desire/requirement.

@titzer I'm not sure why we'd call out the iterable weak set API shape specifically here; this could be accomplished with any API shape, from the proposal's weak ref, to an iterable weak map, to an iterable weak set, ...

from proposal-weakrefs.

titzer avatar titzer commented on July 30, 2024

@domenic I simply meant using "iterable weak set" in a conceptual sense to summarize the use case described here, not any particular API commitment.

from proposal-weakrefs.

domenic avatar domenic commented on July 30, 2024

Ah OK, sure, I'll do that if you think that there's a tie between a generalization of this use case and the API shape.

from proposal-weakrefs.

littledan avatar littledan commented on July 30, 2024

@mathiasbynens wrote up something related to this use case in the explainer. Is there anything else to add, or is it OK to close this issue?

from proposal-weakrefs.

littledan avatar littledan commented on July 30, 2024

Closing due to #17 (comment)

from proposal-weakrefs.

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.