Focus3D / crunchy

Automatically exported from code.google.com/p/crunchy
0 stars 0 forks source link

Injecting code in an interpreter #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In order to avoid having potentially a lot of typing to do when reproducing
an interpreter session, crunchy has an option for "interpreter to editor"
where the simulated input is put into a textarea, ready for execution at
the click of a button.  While the code in that textarea can be easily
changed, the disadvantage of this using this kind of interactive elements
is that to reproduce a long session, the entire code has to be copied over
into the textarea, as each is run indendently.

By contrast, many interpreter inputs may appear on a given page, each
sharing the same interpreter backend.  Thus, and interactive session can be
reproduced, interspersed with explanations and new entry points for the
interpreter.  A complementary option might be to give the ability to
"inject" code into an interpreter.  Thus, by clicking on a button, the code
above an interpreter input could be fed to the interpreter with the result
appearing as though the user would have typed that code.  The user could
then use this as a starting point.

This type of approach would especially be useful if one has to interrupt
going through a "long" interpreter session.  Upon starting a new crunchy
session at a later time, rather than re-typing all the required code to
resume the session, one could click a few (perhaps many) different "inject
buttons" to bring the interpreter to the desired state and continuing the
learning process from that point on.

A particular, but slightly different example, might be for something like
an elementtree tutorial.  At the top of the page, one could define a string
representing an appropriate xml document which could be fairly long.  By
clicking on the "inject button", that string could be fed to the
interpreter and the tutorial as such could proceed from that point forward.

Original issue reported on code.google.com by andre.ro...@gmail.com on 4 Jan 2007 at 4:06

GoogleCodeExporter commented 8 years ago
Specifying milestone : beyond release 1.0

Original comment by andre.ro...@gmail.com on 7 Jul 2007 at 2:22

GoogleCodeExporter commented 8 years ago
implemented via double-clicking on input.  This transforms it as a textarea 
with two
buttons: one to execute the code (and returning to the regular interpreter with 
a
regular input afterwards), the other to copy the code sample shown inside the 
pre
element right into the textarea, ready for editing.

Original comment by andre.ro...@gmail.com on 22 Jul 2007 at 11:59