On Thu, Jan 22, 2009 at 1:35 PM, Samuel Tardieu <[email protected]> wrote:
> experiments, even if I would prefer the Factor standard library to be
> more in a stack-oriented style.

You're forgetting that Ed also invented the cleave combinators, which
have significantly cleaned up pure stack code, and eliminated many of
the cases where one would otherwise need locals.

Indeed, the Factor standard library (core and basis) is written in an
almost exclusively concatenative style. A few words here and there use
locals. Right now a few hundred words in core and basis use locals
(out of more than 10,000) and this seems to be a good balance.

My preferences are as follows, from best to worst:

- Clean stack code with cleave combinators and the occasional simple
shuffle word like dup, over, drop, or swap
- Code that uses locals
- Code that uses complex shuffles like rot, -rot, pick, swapd

So using the stack to the exclusion of everything else is not
something we should encourage. It seems 1-2% of code has complex
dataflow that doesn't fit in with the stack paradigm, and there's
nothing wrong with using locals there.

Slava

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to