-
Notifications
You must be signed in to change notification settings - Fork 14
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
Configurable var transformers & better ellipsis grouping for Turnstile #11
base: master
Are you sure you want to change the base?
Conversation
It's easy to introduce @AlexKnauth's changes from #10: here |
I like the idea of being able to configure this, but it kind of bothers me that it requires the macro to be defined in the phase 1 scope instead of phase 0 like all the other type rules. Is there another way to do this? |
That's a good point. The problem is that the make-variable-like-tranformer call happens in phase 1, even though make-variable-like-transformer is passed as a macro. Its especially confusing to have templates inside templates where the phase level goes to 0 and then back to 1 again (from A possible change would be to make VAR be a phase 1 function rather than macro. But I think this would require some form of eval. |
*even though make-variable-like-transformer is passed as a template. |
Yes, just add in the Also, document that the pattern matching in the ctx is now different from normal |
Would it be better to expand into something like The question is whether my changes for the Edit: The default version of the (define-typed-syntax #%var
#:datum-literals [:]
[(_ x:id : T:type) ≫
--------
[⊢ x ⇒ : T.norm]]) And a version that could be used for proposition environments would be something like this: (define-typed-syntax #%var
#:datum-literals [:]
[(_ x:id : T:type) ≫
#:with propenv (get-prop-env this-syntax)
--------
[⊢ x ⇒ : #,(refine-type/env T.norm propenv)]]) However, that's not really what I would need for occurrence typing. The problem for that is that the |
Update: I tested using a |
Further update: I got around that problem by attaching the syntax property to the syntax before the macro expands, here: If we implement this change with an unhygienic macro reference, expecting it to be defined in the users program, it would force the other projects currently using Turnstile, like Cur and Hackett, to provide this |
Mine does not have any problems with hygiene, AFAIK. It behaves the same as before but factored into functions and macros. Anyways, I'm not sure how either approach would break Cur or Hackett. Shouldn't unconfigured variables behave like before? |
I consider turnstile still in the experimental stage of development, so I think we should be ok with breaking existing programs if it means improving the design. fortunately, neither of the "clients" you mention actually depend on the turnstile package so I think we should do what makes the most sense from a future user perspective. @iitalics: @AlexKnauth is not using the old @AlexKnauth: So there's no way to get what you need without hardcoding the old binding as a prop in |
It has to go through a channel that doesn't get affected by macro expansion, and it has to be put in there by the |
I think the Should we eliminate the |
I'm going to write tests after lunch UPDATE: modified commit to include tests |
83d11f7
to
69fc981
Compare
69fc981
to
6891da2
Compare
#:var-stx
keyword arg to theinfer
function in macrotypes. This allows the exact variable transformer for each element of the context to be specified, e.g.By default, it will use the VAR macro, which just expands into a transformer similar to above.
This also simplifies the introduction of type variables, made possible by
infer
'slet*
-like behavior. Instead of using VAR, you use TYVAR for type variables.We now may be able to remove or just deprecate the
#:tvctx
argument to infer, as this is more general and works as expected.(All given properties will be passed to the variable macro, e.g.
[SPECIAL x ≫ x- : A ~ B ^ C]
will invoke(SPECIAL x : A ~ B ^ C)
).While implementing the new Turnstile syntax, I changed some internal behavior so that it is able to discern previously difficult patterns.
The syntax classes were mostly rewritten but are hopefully very easy to understand. One or two redundant patterns were removed. Syntax is backwards compatible. travis