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

branch[] is nearly useless for cloning oneself #14

Open
devyn opened this issue Jul 28, 2014 · 2 comments
Open

branch[] is nearly useless for cloning oneself #14

devyn opened this issue Jul 28, 2014 · 2 comments

Comments

@devyn
Copy link

devyn commented Jul 28, 2014

This doesn't work because the caller of the third call to stage was given as this Execution, and thus that partially-applied stage remains on the stack after we branch ourselves. stage then attempts to return to us, when really we want it to return to our new branch. So, no looping occurs.

infrastructure execution stage[]
  [infrastructure affix[] [locals]] [infrastructure empty[]];

infrastructure execution stage[]
  [infrastructure set[]
    [infrastructure get[] [locals] [infrastructure length[] [locals]]]

    1] self.portrait;

infrastructure execution stage[]
  [infrastructure set[]
    [infrastructure get[] [locals] [infrastructure length[] [locals]]]

    2] [infrastructure execution branch[] []];

self.portrait [infrastructure execution branch[] [self.portrait]]
@devyn
Copy link
Author

devyn commented Jul 28, 2014

Possible solution: current branch[] becomes clone[], and new branch[] clones the caller and advances the clone.

Rather than the old-style of branch[] which essentially does stage(clone, caller); stage(caller, clone), I suggest one that has an explicit one to give to the clone. Not sure what this would look like though.

@ELLIOTTCABLE
Copy link
Member

So, that solution from last night: definitely won't work. Two reasons:

  1. not very friendly to abstraction; basically have to directly call branch, can't abstract that shit away
  2. basically can't do anything that needs to consume stuff after the branch call, for similar reasons

I've realized it's irrelevant anyway. Turns out, this isn't a deficiency of branch, it's definitely specific to this use of stage. I'm pretty sure this can be solved with an extremely simple abstraction, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants