-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
Cannot rename provided variable used by a snip (in DrRacket) #1916
Comments
I think it is reasonable to consider this a bug in DrRacket in the sense that DrRacket should not call your snip's callbacks on its custodian/eventspace/thread, etc. This is a long standing bug that I do hope to get to eventually, but probably not soon. (I don't think keeping this issue open is helpful, unless there is something else to discuss in the near future.) |
Alright, this makes sense. And ya, I agree that no point in keeping it open in this bug tracker. I should mention though that I am going to run into this issue a LOT in the near future. Could you point me to where DrRacket loads snips so I can take a look at it? |
If you are interested in working on it, I'm happy to provide guidance. My first suggestion would be to start a new discussion on the drracket repo. :) My second one is that what's needed is a new implementation of a snip that works by forwarding messages back and forth to/from a snip that is another eventspace. The high-level idea is that you ahve a snip that has methods whose code is not trusted. So there is a separate eventspace/namespace/custodian under which all calls to it must run. then you have a separate eventspace/namespace/custodian where you run only trusted code that is allowed to communicate only certain things back (anything that doesn't have a procedure in it, roughly). So when you need to render the snip, you send over the bytes that correspond to a bitmap and you build a bitmap on the trusted side. When a mouse event comes in, you forward the mouse event over (which might trigger calling various other snip methods that cause communication to come back), etc. Be aware that the untrusted side's eventspace's main thread might die at any moment, so you'll need to use kill-safe protocols to communicate. The snip protocol has a bunch of moving pieces, but I think that it can probably support this usecase. After that is working (which can be its own separate little library), then DrRacket can just plug it in and the code example above will work properly. |
This makes sense. I am closing this as an issue now and work on it in a separate (smaller) project. Thanks. |
I'm going to tag both @mflatt and @rfindler on this one as I'm not sure if its a drracket bug, or a module path resolver bug.
First, lets make a module
A.rkt
, that simply defines and provides some variablex
:Next, lets make a module
B.rkt
that defines a snip and usesdynamic-require
in the snip's body:When we run module
B.rkt
from within DrRacket we get an empty snip as expected.However, if we switch all instances of
x
toy
in bothA.rkt
andB.rkt
, giving us:I now get a DrRacket internal error:
Of course, if I restart DrRacket the error now goes away, unless I go from
y
back tox
, in which case the error comes back...until I restart DrRacket.I feel like something is getting cached incorrectly, but I'm not sure if its in the module registry, or an internal DrRacket bug. (Or maybe I'm just doing something wrong.)
The text was updated successfully, but these errors were encountered: