pyret-lang
pyret-lang copied to clipboard
Reactor previews do not re-render when handlers change
See short demo below:

This raises a semantic question: since a reactor is a time-varying value, should the preview always show the latest value of the reactor? Does this give us FrTime through the back door? (-:
No - because reactors are not time-varying unless you .interact with them. Joe's screenshot above does seem like a bug, without requiring fully-FRP values in our REPL.
So is the preview always the init state of the reactor? That could be confusing…
(Actually, the above isn't even showing the init state, it's showing the to-draw of the init I believe…
The preview right now the result of <reactor>.draw(). I want to add more gadgetry around this with an explicit “play” button to set it apart; right now it's indistinguishable from an image (which @schanzer reminded me of) and that's bad.
Yeah -- was mulling this over yesterday a bit: I'd like to see a toggleable UI similar to our fractions, that would flip between rendering the world state, and rendering the .draw() output of the world state...
Oooh, I love this! This would really drive home something about the essence of reactors.
Is there currently a way to work with reactors in Anchor? It looks like the reactor itself now renders as a representation of the object, draw shows the to-draw(init), and calling interact loops forever (as if the simulation was running internally without displaying anything in the UI).
Click the image :) As Joe mentioned above, that's not made clear at all. Calling interact should also probably do something clever
@CosineP as far as I can tell, on the currently-published version of anchor, that doesn't work. The reactor definition now shows the object properties view of the object rather than its draw, and calling draw on it shows a static image with no over-time behavior. Neither of them do anything on click, hover, etc.
Ah, right, the current version is missing that. In your picture, where you see r = ..., that should render to-draw(init) like you've manually done below, and clicking it should open a pop-up window that interacts (like in the video in the first message), but IIRC the value type descrimination got rewritten and doesn't include reactors now. If you want to see what's up, the old logic is in reps/RenderKind.tsx and reps/RenderedValue.tsx and the currently used one is, i think, in reps/ValueSkeletonWidget.tsx