FWIW, I see that when the generated javascript is passed back to the 
Jupyter client, the client calls eval() on the javascript. This seems to 
work OK, insofar as it doesn't throw an exception. However - and this is 
where I'm a bit out of my depth - none of the bindings made in the 
javascript seem to be available in the calling context. Maybe this is the 
nature of eval(), but I'm not sure. The "ReferenceError" I reported 
initially seems to actually come from when I try to use the "Elm" object to 
embed the app in a DOM object.

On Monday, March 27, 2017 at 8:10:33 PM UTC+2, Austin Bingham wrote:
>
> Hi everyone,
>
> I started hacking a bit today on a Jupyter notebook kernel for elm. You 
> can see it here:
>
>     https://github.com/abingham/jupyter-elm-kernel 
> <https://github.com/abingham/jupyter-elm-kernel>
>
> It doesn't quite work yet, though, and I think I need help from someone 
> who knows javascript/requirejs/web stuff a bit better than me. The proximal 
> problem I'm seeing is that when jupyter tries to run the elm-make-generated 
> javascript, it thinks that 'Elm' is undefined during (I think) some part of 
> the AMD machinery. Jupyter show this as the output for the cell:
>
>     Javascript error adding output!
>     ReferenceError: Elm is not defined
>     See your browser Javascript console for more details.
>
> As far as I can see, Elm *should* be defined, and certainly the generated 
> code looks like any other Elm output I've looked at. So I'm a bit stumped.
>
> My approach to the kernel is currently very simple. The kernel is 
> implemented in Python, and it receives a blob of Elm source code. I dump 
> this to a temp file, use a subprocess to run "elm-make" to make the output, 
> read the output, and ship it back to jupyter. As far as I can see, all of 
> that is working properly. I run into problems when jupyter tries to execute 
> the stuff I return. This design may or may not be optimal in the long run, 
> but I want to get the plumbing working first.
>
> So if someone feels up to the challenge, I'd love any help I could get. 
> This seems like it should be pretty straightforward, but perhaps I'm being 
> naive and/or missing something obvious.
>
> Of course, I'm also happy to discuss other aspects of the kernel (e.g. 
> design, compilation technique, etc.), but my priority is to just get 
> something into an output cell.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to