Smalltalk-style syntax
From Erights
(Difference between revisions)
(→Verb mapping: expand verb mapping table of examples per new thinking) |
Kevin Reid (Talk | contribs) (publishing old idea) |
||
| Line 36: | Line 36: | ||
} | } | ||
} | } | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
[[Category:Syntax]] | [[Category:Syntax]] | ||
Revision as of 00:21, 24 October 2007
User:Kevin Reid's idle speculation on an alternate surface syntax for E.
Translated mint example:
makeMint does {
run: name = the any {
[sealer, unsealer] = makeBrandPair run: name.
mint does {
__printOn: out = the void {
out print: `<$name's mint>`.
}
makePurse: var balance an (int >= 0) = the any {
decr does {
run: amount an (0..balance) = the void {
set balance = balance - amount.
}
}.
purse does {
__printOn: out = the void {
out print: `<has $balance $name bucks>`.
}
getBalance = the int { balance }
sprout = the any { mint makePurse: 0 }
getDecr = the any { sealer seal: decr }
deposit: amount an int from: src = the void {
(unsealer unseal: src getDecr) run: amount.
set balance = balance + amount.
}
}.
^ purse
}
}.
^ mint
}
}

