8000 Introduce `ShapeId` · Issue #540 · facet-rs/facet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Introduce ShapeId #540

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

Open
85C0
fasterthanlime opened this issue May 10, 2025 · 0 comments
Open

Introduce ShapeId #540

fasterthanlime opened this issue May 10, 2025 · 0 comments
Labels
✨ enhancement New feature or request

Comments

@fasterthanlime
Copy link
Contributor

Should be shape_id: Option<ShapeId> in struct Shape because:

  • Scalar types and opaque types should have a manually picked ShapeId (that does not clash with other ShapeIds)
  • Recursive types cannot have a ShapeId, because we cannot have cyclical associated consts — as soon as there's a pointer, which would allow recursing (including smart pointers etc.) then we have None and that's too bad, but we can still use type_id at runtime.
  • However, generic types can have a shape ID: we can do fnv1a in const, so we can "mix" the T, K, V, whatever's shape IDs with the container's

This would allow matching against certain types in const contexts, which as close to #98 as we can get for now.

@tversteeg tversteeg added the ✨ enhancement New feature or request label May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants
0