Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

wait keyword and process #35

Open
Adrodoc opened this issue Jun 29, 2016 · 2 comments
Open

wait keyword and process #35

Adrodoc opened this issue Jun 29, 2016 · 2 comments

Comments

@Adrodoc
Copy link
Owner

Adrodoc commented Jun 29, 2016

Add a keyword wait that will wait for one tick.
To wait 2 or more ticks there should be a process with the name wait with a parameter time of type value as defined in #31.
This process should have the modifier remote (#34) to make sure that calling and returning takes one tick each.

An implementation could look roughly like this:

remote repeat process wait(value ticks) {
  ticks -= 1
  if: ticks < 2
  then {
    return
  }
}
@Adrodoc Adrodoc added this to the v2.0 milestone Jun 29, 2016
@Adrodoc Adrodoc modified the milestone: v2.0 Mar 1, 2017
@Adrodoc
Copy link
Owner Author

Adrodoc commented Mar 1, 2017

Instead of a wait keyword we could use an inline process with an embedded script via #43. The script would then check the ticks parameter to decide whether to delegate to a remote implementation or use a local 1 tick delay:

process wait(Integer ticks) {
  groovy {
    if (ticks <= 1) {
      mpl << 'start ${this + 1}'
      mpl << 'skip'
    } else {
      mpl << "waitForValue(${ticks})"
    }
  }
}
repeat process waitForValue (Value ticks) {
  ...
}

@Adrodoc
Copy link
Owner Author

Adrodoc commented Mar 6, 2017

If the first implementation is chosen (wait keyword) it might be possible to remove the keyword skip and relative this inserts /say ${this + 1}, because they are only really useful for waiting one tick. This would simplify a lot of code, because we could get rid of the internal/generated by flag. Maybe relative this inserts should be kept for debugging purpuses, in which case they could just operate in chainlink basis rather than on chainpart basis.

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

No branches or pull requests

1 participant