-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Use-site binder hygiene bug for let
#474
Comments
Given the current way Rhombus blocks are expanded, I think the alternative strategy you suggest will require much more significant change, because the expansion uses a trampolining macro, which can’t thread through an opaque internal-definition context value. I’ll do some investigation to see what is exactly happening, but I don’t think we can change the strategy very easily. Another thing that’s curious about #lang racket/base
(require compatibility/package)
(define-package test ()
(define* x "outer")
(define-syntax-rule (m id)
(begin
(define* id "inner")
(println x)))
(m x))
;; prints "inner" |
After some more thinking, I’m not sure the Racket example really corresponds to the Rhombus counterpart either. Racket Edit: By the way, the situation is quite like that in Section 2.5 of “Binding as Sets of Scopes”. |
One thing that is broken:
I think we can all agree that this should be Edit: And, I haven’t thought enough about this, but could #341 be a similar issue? |
(A general point. I don't think it is correct to ask 'how much change does it take' but 'do we need to widen the API' (with a new syntax-local-zoo-thingie) or 'what is a good way to solve this problem' (not 'best'!). Too often language design -- some of ours included -- piles on little tweaks here and more little tweaks there and the resulting system looks in the end like a mess.) |
To me, this depends on how we think about modeling scoping structure from a user's perspective. Things like use-site scopes and definition contexts are our internal implementation tools, but should users have to think in terms of them? To me, Rhombus The |
Would it be possible for Rhombus to leverage |
I'm not so worried about For use site scopes, than @usaoc for the reminder (and for tracking down) that it's not in place, yet. I'll work on filling that in. Thanks @michaelballantyne for the reminder that I don't agree that Rhombus Since I think about
where the result is |
Related to racket#341 and racket#474.
I've previously discussed this with @mflatt , but I figure I should make a ticket.
Consider this program:
It returns "inner", but I think it should return "outer" like the similar Racket program does:
I want to point this out now because I saw racket/racket#4929, which proposes to add something new to the
syntax-local-
zoo to support the implementation of Rhombuslet
. I'm a little skeptical of the current implementation strategy forlet
given that it gets this use-site binder hygiene wrong, and it feels like it'd be unfortunate to expose more low levelsyntax-local-
operations that could point users towards implementations of scoping structures that don't get hygiene right.In contrast, an implementation of
let
using definition contexts and local-expand should be able to avoid this problem because one of the things definition contexts encapsulate is a set of local use-site scopes. I don't know enough about Rhombus to know what other implementation constraints there are, though.The text was updated successfully, but these errors were encountered: