Slava Pestov <sl...@factorcode.org> wrote:
> 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.

Yes, that's significant. Then there's also the "looking a gift horse
in the mouth" problem.

In general, I don't think there's a problem with accepting
locals-using definitions; I also don't think we should be promoting
them as good Factor style per se (although of course we should have
style rules that FUEL can follow for when they are used).

In addition to welcoming any Factor code, we (historically) definitely
welcome rewrites of locals-using Factor code. Such rewrites test and
demonstrate Factor's expressiveness.

> 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.

It's notable (in a good sense) that this situation has steadily
improved over time.

> 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

Out of curiosity, what did you think of Nowak's "banana notation" (|
|) for his spread-like combinator? (The major difference between
spread and his combinator is that his combinator doesn't allow the
quotations to access each other's results.) I found the notation
interesting because it allows the person reading the code to clearly
see the nature of the code up-front, rather than having to trace out
where a quotation is being produced and consumed every time.

> Slava

-Wm

------------------------------------------------------------------------------
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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to