-
Notifications
You must be signed in to change notification settings - Fork 26
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
Record keyword/sigil ambiguity bikeshedding #25
Comments
Reposting some comments from Gitter: @aatxe https://gitter.im/pikelet-lang/Lobby?at=5af303ad00dc488804a8994d
@brendanzab https://gitter.im/pikelet-lang/Lobby?at=5afad494e0b50c2d05c3612f
@evincarofautumn https://gitter.im/pikelet-lang/Lobby?at=5afb2d7ef04ce53632dd1ad3
|
One weird idea:
|
I don't really like the
(Sorry if this was already discussed on gitter. Also, this looks like a really cool project 👍 💯.) |
Yeah, no worries!
I agree too fwiw. A different sigil for implicit args could definitely be a solution. 🤔 |
Don't worry about repeating stuff from Gitter. I try to make sure stuff eventually ends up on Github in a less ephemeral form, so appreciate the chatting and discussions on here! I realise that it's sometimes easier for people to dip in and out of the issues at their leisure rather than keeping up to date with the chat. Also, I appreciate the compliments, it means a lot! |
I'd like to use bare braces for implicit arguments (see #8), so we'll need a keyword or sigil for dependent record syntax (see #2). Now, if I just used a single identifier, like
record
, for record types and record values, I would run into the following ambiguity:Is this an empty record value, or the type of an empty record?
If we were going to have default fields then we would run into a similar issue:
Is this a record value with a field annotated with a type
I32
and a value23
, or is it a record type with a field of typeI32
and a default value23
?One way to resolve this would be to defer this choice to type checking, and require annotations in ambiguous circumstances. Bidirectional checking should make this trivial, but I'm not sure how nice it would be ergonomically.
Idris has a similar ambiguity around
()
, which can stand for the 'unit value' or the 'unit type'. It however defaults to the unit value in ambiguous circumstances, and coerces to a type or value when it has the necessary type information:Another option would be to have two different keywords, but then I have to decide on that:
Record
/record
is one way, using a capital to signify the change in universe levelStruct
/struct
- would convey more of a feeling of that fact we want a non-uniform memory representationsig
/struct
, like in ML?sig
/record
?signature
/record
- maybe a bit verbose?The text was updated successfully, but these errors were encountered: