The reason it's not a tail call is because match-cond creates its own
dynamic scope to allow the outputs to be read. If it's possible, maybe
this should be changed to static scope, though I'm not sure how that
could work exactly. If static scope were used, it would be possible to
make it a tail call. For your specific example, it would be more
idiomatic in Factor to replace the entire match-cond with the word
first2 to get the elements at the 0 and 1 positions out of the array.

Daniel Ehrenberg

> Uh-oh, I wasn't aware of this. However, in this case using match-cond in
> servers (in the sense of the concurrency module), as the docs' examples
> suggest, seems to be not a wise choice. (Even if it neatly resembles
> Erlang style server processes.) Or maybe match-cond should be altered so
> that the matching quotation is tail called?
>
> Csaba

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to