-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Records #15
Milestone
Comments
@kurobako I updated this with what I'm thinking could be done pretty quickly... |
I am not sure if I like (foo, bar) syntax since it looks like a tuple (yes it is, but element indices are different since first one is the symbol. Can we use something else instead? { } are free iirc, wdyt? |
akovari
added a commit
that referenced
this issue
Feb 15, 2020
akovari
added a commit
that referenced
this issue
Feb 15, 2020
akovari
added a commit
that referenced
this issue
Feb 16, 2020
akovari
added a commit
that referenced
this issue
Feb 18, 2020
akovari
added a commit
that referenced
this issue
Feb 23, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Implemented using tuples, where the first element is the name of the record
Syntax sugar, derived from tuple syntax, that is removed during parsing
Records are module scoped
Declaration syntax:
record Person = (first_name, last_name)
let person = Person(first_name = "Adam") # at least one field is required, although it can technically be ()
person.first_name
fun Person(first_name=f, last_name=l) # where f and l are bound to the values of first/last name from that record
fun p@Person # way to access the whole record in pattern matching, similar to sequences for example
let new_record = old_record(field = value)
The text was updated successfully, but these errors were encountered: