Skip to content
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

Cyclical Dependency: define-syntax-category <-> infer #48

Open
iitalics opened this issue Mar 8, 2018 · 4 comments
Open

Cyclical Dependency: define-syntax-category <-> infer #48

iitalics opened this issue Mar 8, 2018 · 4 comments

Comments

@iitalics
Copy link
Collaborator

iitalics commented Mar 8, 2018

There's a cyclical dependency between define-syntax-category and infer. The former defines functions like current-type-eval which are used by the latter. However, the type-generated forms of define-syntax-category, most prominently define-binding-type, make calls to infer when expanding kinds (or something like that).

Turnstile was able to get away with this because define-syntax-category would not define any binding types initially, then infer is defined, then user languages would call define-binding-type which would generate code to call infer. In trying to reduce syntax-parse-defining-macros, I moved the infer calls out of define-binding-type, which breaks.

I can solve this with a higher order function but that's clearly a patch, not a solution.

@iitalics
Copy link
Collaborator Author

iitalics commented Mar 8, 2018

here

@stchang
Copy link
Owner

stchang commented Mar 8, 2018

What error do you get, unbound identifier? Shouldnt the lifted transformer function still be at the same phase as current-type-eval?

@iitalics
Copy link
Collaborator Author

iitalics commented Mar 8, 2018

Yes it's unbound identifier. Which on second thought doesn't make a lot of sense because expand/df resolves yet its defined below infers+ctx/erase. 🤷‍♂️

However it does spit out a ton of scopes when attempting to use infers+ctx/erase:

macrotypes/typecheck.rkt:824:35: infers/ctx+erase: unbound identifier in module (in phase 1, transformer environment)
  context...:
   #(2136 module) #(2138 module typecheck 1) #(14047 macro) #(27743 local)
   #(27744 intdef) #(27752 local) #(27753 intdef) #(27755 local) #(27757 intdef)
   #(27761 local) #(27762 intdef) #(27766 local) #(27771 intdef) #(27772 local)
   #(27773 intdef) #(27777 local) #(27778 intdef) #(27781 local) #(27783 intdef)
...
...
   #(28234 intdef) #(28235 local) #(28236 intdef) #(28239 local) #(28241 intdef)
   #(28244 local) #(28246 intdef) #(28258 local) #(28259 intdef) #(28265 local)
   #(28272 intdef) #(28273 local) #(28274 intdef)

I'm not sure what this means. The scopes aren't printed if I use some other garbage identifier instead.

@stchang
Copy link
Owner

stchang commented Mar 26, 2018

It seems type-error is affected as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants