-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Hacker news had a link to Zuo recently:
That has support for "struct", which seems to do a bunch of things. Given the following code:
(struct person name age)
Generates a bunch of things:
- Generates a constructor
(set! person (fn* (name age))
- Generates a type check
- `(set! person? (fn* (x) ... is x an instance of person)"
- Generates accessors for each field
(set! person-name (fn* (strct) (return strct.name)
(set! person-age (fn* (strct) (return strct.age)
More stuff wasn't immediately obvious, but I guess there are setters to match the getters. I guess the complication for implementation would be the creation of the methods, dynamically.
Metadata
Metadata
Assignees
Labels
No labels