Coder Social home page Coder Social logo

Comments (7)

dphfox avatar dphfox commented on June 11, 2024 1

Usable<T> could be a good proposal, too.

from fusion.

Sluethen avatar Sluethen commented on June 11, 2024

Verbose isnt always bad thing.
In this case its clear as day what CanBeState means, while something like Dynamic doesn't get across immediately
CanBeState isnt even that long

from fusion.

dphfox avatar dphfox commented on June 11, 2024

Verbose isnt always bad thing.
In this case its clear as day what CanBeState means, while something like Dynamic doesn't get across immediately
CanBeState isnt even that long

This is the single most used type definition across all Fusion code bases I've ever worked with, and likely it's going to increase over time, so every little bit counts here. I've found this type name clutters up a lot of property list definitions especially, so I'm interested in optimising that use case.

from fusion.

dphfox avatar dphfox commented on June 11, 2024

Perhaps a name like MayChange<T> helps retain some of the original clarity while still moving away from assuming knowledge of state objects.

from fusion.

dphfox avatar dphfox commented on June 11, 2024

After some further discussion in the community Discord channel, we considered a few more names:

  • Describes<T>
  • Contains<T>
  • Becomes<T>
  • Into<T>
  • UsedAs<T>
  • As<T>
  • StateOf<T>
  • StateOr<T>
  • Or<T>
  • Maybe<T>
  • a bunch of other rejected ideas

After much discussion we settled on a few strong ideas:

  • StateOr<T> - essentially a more concise CanBeState<T>, but still leans heavily on state terminology which goes against the goal of pushing state objects further into implementation detail territory
  • Describes<T> - conveys a lot of meaning, but can be a little bit clunky in large code blocks
  • Becomes<T> - same issue as above
  • Contains<T> - strongly leading name; seems to suggest the existence of a structure
  • UsedAs<T> - very concise and nicely encapsulates the way people think about this type (don't care what it is, only what comes out of use()), but would be nicer to consolidate down to one succinct word
  • As<T> - almost as strong as above, avoids its main issue but loses out a bit on clarity - is is clear that new users know what it means?

Right now, myself and the people who I talked to agree that As<T> seems to have the strongest combination of traits, but I think it is still good to collect further thoughts on this.

from fusion.

dphfox avatar dphfox commented on June 11, 2024

The symmetry of type Use = <T>(UsedAs<T>) -> T is quite nice.

from fusion.

dphfox avatar dphfox commented on June 11, 2024

After talking with some more groups, common opinion seems to be that the clarity of UsedAs<T> outweighs the conciseness of As<T>, so (at least for the time being) I think that it would be the option that achieves most of the goals set out above while retaining enough clarity to be understood by a wide audience.

from fusion.

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.