[stack] Re: QuoteAndEval
"Raymundo Quirino Baquirin" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
Hi, Manfred, This discussion triggered a memory which caused me to consult a REXX manual. In REXX ordinary strings enclosed in matching single or double quotes are considered commands to be sent to the operating environment. In fact, any expression which upon evaluation was not recognized as a language instruction is considered a command--quoting the expression if in fact it was an OS command tells REXX not to bother evaluating it, just ship it off to the OS and get a return code back. In fact, the operating environment could be set to a custom program, not necessarily the OS shell. IMHO something like this would be great for an embedded Joy, such as JoyJ. Of course something like the Unix backquote syntax would be required. Servus, Ray --- In [email protected], Manfred Von Thun <m.vonthun@...> wrote: > > > > > On 14/5/08 6:19 AM, "William Tanksley, Jr" <wtanksleyjr@...> wrote: > > > > Manfred Von Thun <m.vonthun@... <mailto:m.vonthun%40latrobe.edu.au> > > > wrote: > > > >> > Is there a lesson to be learned for concatenative languages? > > > > I don't know what the lesson would be. Backquotes escape from a string > > context to an executation/evaluation context. I suppose one could do > > that in a concatenative language that had a string syntax. > > > Maybe I should not have chosen those examples with the chatty strings inside > which > the backquote occurred. Here is an example that illustrates the Eval = > Unquote > principle: Eval(Quote(x)) = x: > > echo `date` = date > > For a concatenative language the lesson would be a facility to reach out > into the numerous Unix utilities which compute unary functions from > streams of bytes to streams of bytes. It would start with a string in the > concatenative language and end up with another string. All the Unix piping > would be done at the level of the concatenative language. The example > of counting the files in the home directory would look like one or the > other of these: > > ³la ~² ls ³-l² wc > ³ls la ~² unix ³wc l² unix > > This should leave a string of digits on top of the stack (or perhaps better, > an integer). > > > More generally, I suppose one could "escape" from any context to an > > evaluation, thus allowing you to compute a value at runtime which will > > be compiled into the current quotation. > > > I definitely meant escaping to unix. Escaping to evaluate a quotation > is already in Joy: suppose there is a quotation on top of the stack. Then > > stack swap infra first > > or something similar will push the result of executing the quotation > onto the stack. Whether that result is to be spliced into another > quotation (what you called the current) is another matter again. > > - Manfred > > > > [Non-text portions of this message have been removed] >