> 2) Words that operate on data types leave (especially as "transforms")
> them on the stack or a transformed version. That's tuples, vectors,
> hashes, etc. and words like push, >string, etc.  Words like at also fit
> this way by transforming their inputs to a single output.
> 3) Alternative words for rule #2 that don't leave them on the stack end
> in !.  This would be used in the least common cases and would be a way
> to say "watch out!".

Words do follow a consistent convention for stack effects right now;
it just isn't this one that you've specified. The difference is in
parts 2 and 3 of what you wrote. The convention is that words
generally don't return their arguments; they return other things. So
>string returns the new string, but push doesn't return the same
sequence that was pushed to.

Of course, just because this is the current convention doesn't mean
it's the way things should be. Maybe we should adopt something like
this, as long as we are consistent, at least within the core
libraries. (As Chris rightly pointed out, it makes sense to experiment
in other libraries.)

On #concatenative, you (Zed) suggested that nth should act like over
nth, but in my experience things like that (at least in the general
case, and with nth) are not useful. Very often (I suspect most of the
time, but I haven't counted) you don't end up needing to preserve the
sequence itself in that way. One convention in argument ordering is
that we try to take the argument most likely to be literal from the
top of the stack, which is why nth, set-nth, at and set-at take their
sequence/assoc from the top of the stack.

Dan

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to