Thomas S. Dye writes:

> Alan Schmitt <alan.schm...@polytechnique.org> writes:
>
>> Eric Schulte writes:
>>
>>> Alan Schmitt <alan.schm...@polytechnique.org> writes:
>>>
>>>> "Sebastien Vauban" <wxhgmqzgw...@spammotel.com> writes:
>>>>
>>>>> In a hurry, to repeat the code:
>>>>>
>>>>> - use named blocks
>>>>> - use Noweb expansion
>>>>>
>>>
>>> Another option would be,
>>>
>>> 1. use named blocks
>>> 2. use call lines
>>
>> Thanks for the suggestion. I tried using a call line, but it does not
>> allow me to include the source code again (it's great to re-run the code
>> once more, though).
>
> What call line did you try?

This is what I tried

#+begin_src org
** Prototype-based objects

#+name: object_example
#+begin_src js :results code output :exports both
var f = function(a) {
        this.x = a
}

f.prototype = {y : 1}

var o = new f (42)

console.log("o.x = " + o.x + ", o.y = " + o.y)
#+end_src

Results

#+results: object_example

** Prototypes resolution

Some other slide

** Prototype-based objects

#+call: echo(object_example) :results code output :exports both
#+end_src

My problem with this was twofold: the code from "object_example" is
not repeated, and the highlighting of the results in the "#+call:"
line is not in javascript syntax.

Using a "noweb" approach solves both issues.

Alan

Reply via email to