-
-
Notifications
You must be signed in to change notification settings - Fork 103
WIP: add type-out provide-spec #301
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
base: master
Are you sure you want to change the base?
Conversation
;; actually do the work on a module | ||
;; produces prelude and post-lude syntax objects | ||
;; syntax-list -> (values syntax syntax) | ||
(define (type-check forms0) | ||
(define forms (syntax->list forms0)) | ||
(define forms (lift-type-declarations (syntax->list forms0))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible issue: I'm re-ordering the top-level forms so that type declarations come first. Without this, type annotations aren't associated with the right definitions.
Not sure whether this will change to fix the bug with structs.
A few thoughts:
|
|
Leif pointed out that we definitely don't want struct properties declared in a provide form, so now I'm in favor of writing the fields twice (in code & in the |
I think we should start with something that just handles type annotations, and see how that works. I don't think provide should produce definitions (except as an implementation detail, as in contract-out), and I think information hiding a la ML modules is a larger design issue that deserves more thought before we start implementing. |
Ok. Do you mind if it allows
|
That's what I mean about definitions. I don't think provide should introduce new bindings in the module. Nothing else in Racket works that way. |
Checkpoint:
Is there an easy way to get struct information from the struct type name? I tried
|
Things are pretty good now, but I'm blocked on 1 problem and have a few questions: Problem: this is currently incompatible with the Questions
EDIT: supertype fields must not be included, field order is enforced |
status update: this PR is not ready to merge because it doesn't handle structs as well as |
(Work-in-progress because there's a bug with
(type-out (struct ...))
-- you can't use the struct inside the defining module.)Adds initial support for a
type-out
provide spec.Design goals:
contract-out
(currently missing#:exists
and#:forall
)Current look:
Later on, I'd like to add
#:exists
&#:forall
to bind variables across multiple type definitions, and options to export opaque types and ADTs. But I think it's better to address those separately.