marbelous-lang / docs

Documentation, examples, etc.
Apache License 2.0
3 stars 3 forks source link

Lock/Release device pair #7

Open m-ender opened 9 years ago

m-ender commented 9 years ago

An asymmetric version of the synchronisers could be useful. Say we call them Rn and Ln. The Ln hold a marble like a synchroniser and stall. The Rn let all marbles pass through. But if a marble goes through an Rn, all marbles in the corresponding Ln are released.

(This would be a device which cannot be implemented within Marbelous, so would be an actual language addition.)

es1024 commented 9 years ago

Ln could just be a regular synchroniser, and then have the Rn device influence the normal synchronisers' behavior. (Then &0 would stall until all &0 devices or a |0 (using |n here for Rn) is reached).

mrskin commented 9 years ago

Is there a meaningful symbol for these? So far we don't have any devices with alphabetic first letters.

es1024 commented 9 years ago

@mrskin I believe that was a deliberate choice (to use symbols for base devices to free up the namespace for naming boards). I'd suggest |n for the release device: synchronisers are &n, and act somewhat like an AND operator (all must be filled to continue), and the release device acts somewhat like an OR operator (either all synchronisers are filled, or the release device is filled when the synchroniser is released).