-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add new builtin: @typeId #19858
Copy link
Copy link
Closed as not planned
Labels
proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.
Milestone
Metadata
Metadata
Assignees
Labels
proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.
Add a new builtin called
@typeId:This builtin returns a unique integer for each type passed, and will return the same integer for the same type.
The return value must not be consistent inbetween builds, so a second build might return completly different numbers
for the same types.
An alternative variant might return
u32oru64to have a stable interface between different platforms.Use cases
Prior art:
User-land implementation
The following version is runtime only, as we can't perform intFromPtr at compiletime: