| Re: RfD - Enhanced local variable syntax, v4 (long) |
|
 |
|
 |
|
 |
|
 |
Group: comp.lang.forth · Group Profile
Author: Bruce McFarlingBruce McFarling Date: Sep 6, 2008 14:30
On Aug 23, 4:59 pm, Bernd Paysan wrote:
> Looking at bigFORTH's sources, F{ could be useful. To be more precise: a F{
> that changes the default defining words of the locals to float, and still
> has the same prefixes.
> { f: ri f: rm f: ro f: h n }
> becomes
> F{ ri rm ro h w: n }
So looking at the one-shots with a choice between { and f{ ...
ans-report.fs:: standardword { D: wordname D: wordset -- }
same, cost 1 token relative to switching
glocals.fs:\ : CX* { F: Ar F: Ai F: Br F: Bi -- Cr Ci }
-> glocals.fs:\ : CX* F{ Ar Ai Br Bi -- Cr Ci }
saves 4 tokens, benefit 1 token relative to switching
libcc.fs:: gen-wrapped-call { d: pars d: c-name fp-change1 sp-change1
-- }
same, break-even relative to switching
locals-test.fs:{ c: a b c: c d: d }
same, benefit one token relative to switching
prof-inline.fs: { d: ud-dyn-callee d: ud-dyn-caller u-stat u-exec-
callees u-callees }
same, breakeven relative to switching
stuff.fs:: f>buf-rdp-try { f: rf c-addr ur nd up um1 -- um2 }
same, saves one token relative to switching
So I guess it has about the same saving of net two tokens in Anton's
test as switching, does not require a definition of a new "stream
switch" token for a construct that is already a bit syntax-heavy, and
pretties up what would be the most common use of locals for me,
floats.
OK, that looks close enough for government work to me.
|