pyret-lang icon indicating copy to clipboard operation
pyret-lang copied to clipboard

Reactor previews do not re-render when handlers change

Open jpolitz opened this issue 3 years ago • 11 comments

See short demo below:

Mar-09-2022 09-21-45

jpolitz avatar Mar 09 '22 17:03 jpolitz

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? (-:

shriram avatar Mar 09 '22 17:03 shriram

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.

blerner avatar Mar 09 '22 17:03 blerner

So is the preview always the init state of the reactor? That could be confusing…

shriram avatar Mar 09 '22 18:03 shriram

(Actually, the above isn't even showing the init state, it's showing the to-draw of the init I believe…

shriram avatar Mar 09 '22 18:03 shriram

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.

jpolitz avatar Mar 11 '22 16:03 jpolitz

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...

blerner avatar Mar 11 '22 16:03 blerner

Oooh, I love this! This would really drive home something about the essence of reactors.

shriram avatar Oct 11 '22 09:10 shriram

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).

image

asolove avatar Jan 01 '23 04:01 asolove

Click the image :) As Joe mentioned above, that's not made clear at all. Calling interact should also probably do something clever

CosineP avatar Jan 01 '23 19:01 CosineP

@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.

asolove avatar Jan 02 '23 19:01 asolove

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

CosineP avatar Jan 06 '23 04:01 CosineP