On Mon, Jul 28, 2014 at 9:11 PM, Tomas Hlavaty <t...@logand.com> wrote:
> I can't make sense of what you are trying to achieve.  Why do you want
> to use transient symbols?  Why not use normal interned symbols?  How
> does your use case differ?  Do you have a simple example?

Suppose you embed a DSL in Picolisp, like this:
(de Afficher (msg)
   (println msg))
Where «Afficher» is the French for «Display».
Now here is a simple program:
(Afficher "Hello!")
When run it with the definition above, the message "Hello!" is displayed.

Now I want to export the program to XML to build a blocks configuration
for Blockly. An example built (then tweaked by hand) with:
<block type="Afficher">
  <value name="TEXT">
    <block type="text">
      <field name="TEXT">Hello!</field>

Consider that Afficher is not the only command of the language.
There is a kind of «concatenate», a «read»…
The Lisp syntax is marvellous because the data I need to translate (the
program) is also source code (well, it was since the beginning!).
All I need is to reprogram my DSL like this:
(de Afficher (msg)
     "<block type=\"Afficher\"><value name=\"TEXT\">"

But I need transient symbols to spontaneously have the value:
<block type="text"><field name="TEXT">*****</field></block>
Where ***** is the name of the transient symbol.
I could assign each transient the right value, but a bit of magic
would save time.

Is it better?



http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to