Skip to content
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

First class types #21

Closed
2 tasks done
Tracked by #109
giann opened this issue Mar 18, 2022 · 0 comments
Closed
2 tasks done
Tracked by #109

First class types #21

giann opened this issue Mar 18, 2022 · 0 comments
Labels
language Issue related to the language
Milestone

Comments

@giann
Copy link
Collaborator

giann commented Mar 18, 2022

First class types

type myType = <str>;

fun handleAnything(any value) -> typeOf(value) == myType;
  • Types as value
  • typeof operator

Edge cases:

  • We would expect a reference to MyObject to be a type, but it's not. It's a reference to the value ObjObject. So user whishing to get the MyObject type would have to do: typeof MyObject.
  • On the other hand, a foreign struct is an ObjTypeDef at runtime so we don't need the typeof operator to get its type.
  • Same for Protocol whose runtime representation is also an ObjTypeDef
@giann giann added feature language Issue related to the language labels Mar 18, 2022
@giann giann added this to the 0.3.0 milestone Mar 18, 2022
@giann giann removed the feature label Dec 27, 2022
@giann giann mentioned this issue Aug 21, 2023
11 tasks
@giann giann modified the milestones: 0.5.0, 0.3.0 Aug 21, 2023
giann added a commit that referenced this issue Aug 21, 2023
giann added a commit that referenced this issue Aug 21, 2023
giann added a commit that referenced this issue Aug 21, 2023
giann added a commit that referenced this issue Aug 21, 2023
@giann giann mentioned this issue Aug 22, 2023
Merged
@giann giann closed this as completed in 5823569 Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language Issue related to the language
Projects
None yet
Development

No branches or pull requests

1 participant