-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how can i identify a struct, and whether it's shared? #23
Comments
Because [[Prototype]] chains are immutable for both unshared and shared structs, you should use For unshared structs, there's nothing really distinguishing it from a sealed object with non-generic methods. For shared structs, it might be worth adding a brand check, or at least a general What's the use case? |
Debugging, logging, test frameworks - anything where a value needs to be described in a robust way. For unshared structs, is there any special behavior they have, or is it literally just syntax sugar for something else? Can I perfectly replicate an unshared struct without the syntax? A predicate would be perfectly fine, for either/both. |
But what's the use case for debugging, logging, and testing unshared structs differently than sealed objects? I can see the need to do it for shared structs, but there I see it as a need for all shared objects.
You'd have to write some custom constructors but yes. |
In that case I'd only require a predicate for shared ones, even though it'd still be nice for an unshared one. I totally agree that it applies to all shared objects, but in order to have the ability to help the user find the thing in question in their code, i'd still need to know that it's a shared struct, specifically. |
Considering this issue addressed. To recap:
|
My understanding is that a struct is just a sealed object with null, or another struct, as a [[Prototype]] (shared structs may have an object with methods as their [[Prototype]]).
Given some
x
, how can i determine if it's an unshared struct, or a shared struct, vs a non-struct?The text was updated successfully, but these errors were encountered: