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

Null continuation doesn't escape from calling context. #1212

Closed
brianharvey opened this issue May 7, 2016 · 11 comments
Closed

Null continuation doesn't escape from calling context. #1212

brianharvey opened this issue May 7, 2016 · 11 comments
Assignees
Labels

Comments

@brianharvey
Copy link
Collaborator

From Jonathan50 via forum:

Continuations (and so catch/throw, and so the multibranched conditionals library) don't “escape” when there is nothing to do (the continuation is empty).
So if I have a cases block with nothing after it then all the cases are tested…

Confirming: This script
cases-test
should just say "b" but actually says b-c-d unless another command follows the CASES block.

@brianharvey brianharvey added the bug label May 7, 2016
@brianharvey
Copy link
Collaborator Author

Note: I have temporarily kludged around the problem in the cases library by adding a no-op command after the catch.

@jmoenig jmoenig self-assigned this May 8, 2016
@jmoenig
Copy link
Owner

jmoenig commented May 8, 2016

Good catch, will fix. Thanks!

@jmoenig
Copy link
Owner

jmoenig commented May 8, 2016

I'm confused. I know that there is an issue if you try to catch the very end of a script unless you specifically tag it. But I can't reproduce the behavior you describe. Here's your test case:

http://snap.berkeley.edu/snapsource/snap.html#cloud:Username=jens&ProjectName=ctest

it says 'b' and then stops. Doesn't it for you?

@brianharvey
Copy link
Collaborator Author

That's because you missed my comment above saying I edited the CASES library to add a no-op (the HIDE VARIABLE block) at the end. Edit the CASES block, remove that no-op, and then try.

@jmoenig
Copy link
Owner

jmoenig commented May 8, 2016

Du-oh. Thanks!

@jmoenig
Copy link
Owner

jmoenig commented May 8, 2016

Okay, can you please test my fix for null continuations in the dev version:
http://snap.berkeley.edu/snapsource/dev/snap.html
Thanks!

@brianharvey
Copy link
Collaborator Author

brianharvey commented May 8, 2016 via email

@jmoenig
Copy link
Owner

jmoenig commented May 8, 2016

Thanks for the quick test. The fix is really simple: A null continuation terminates the thread, same as stop this script.

@brianharvey
Copy link
Collaborator Author

Seems sad that you had to special case it. An empty stack should really be just like any stack. (And while you're at it, I want world peace.)

@jmoenig
Copy link
Owner

jmoenig commented May 8, 2016

I already did special case null continuations, but only as noops, which was clearly wrong, all I did now was to change it from "doYield" to "doStop". In a perfect Scheme world, of course, scripts would be represented as lists, so I could just "set" it to the end of that list. In a perfect blocks language the blocks themselves are the ... actually I don't know anything about perfect languages. But Yay for world peace!

@jeandrek
Copy link

jeandrek commented May 24, 2016

Yay 🎉

brollb referenced this issue in NetsBlox/Snap--Build-Your-Own-Blocks Aug 26, 2016
NaveedMohammed pushed a commit to c2stem/snap-physics that referenced this issue Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants