Enabling other languages?

Congratulations on Observable, it is a great idea and the execution is very nice!

I’d prefer to use Clojurescript over javascript given enough support (I actually got something working here Untitled / Jeroen van Dijk | Observable).

Are you considering supporting other languages natively as how you support javascript (e.g. syntax highlighting, no need to wrap with backticks etc)?

3 Likes

Super cool that you got something working inside of a notebook!

Though it would be super cool to add more languages in, it’ll be a pretty gradual process. Unlike most other notebooks, Observable is very semantic - a lot of the magic is how a mixture of static analysis and a smart runtime can simplify programming. We wouldn’t want to, say, add ClojureScript support but require you to manually re-evaluate cljs cells - we’d want cross-language evaluation to be at least reasonably reactive, in the way that evaluation is currently reactive.

Of course no shade on ClojureScript (I’ve built a few things with Clojure and mightily enjoyed it), but the focus for now is on making an exceptional environment, and then on potentially cross-language capabilities.

5 Likes

I wonder if we could have other languages in Observable. Is this issue in the pipeline?

There’s an older thread on this here: Enabling other languages?

(And now we’re merged!)

2 Likes

I suppose you can always try the tagged template approach, but then the other language is more like a pre-processor (edit: just noticed that this is exactly how the ClojureScript works in linked notebook at the start (waarom is Kees eigenlijk een topper, @jeroenvandijk?))

Take a look in the ganja.js topic for more ideas:

Also, you just inspired me to try embedding the Walt compiler in the Observable notebook, seems to work pretty well!

So that means runtime JS-like WASM for the masses :slight_smile:

very nice notebook! to make it work on a retina screen, you might want to use context = DOM.context2d(width, height, 1) or adapt all the canvas.onmouse* (otherwise it paints only the top-left quarter of the screen).

1 Like

Thanks for the tip! (I wonder if this fixes the phone size bugs in my other notebooks too edit: nope :frowning: )

A small suggestion: https://beta.observablehq.com/d/a725945e96948f7b#compiledWaltBuffer uses the visual (barcode) of the compiled code as a viewof. This way, no need to have two separate cells. And the function is reusable. This is similar to https://beta.observablehq.com/@fil/pt

1 Like

Nice, thanks! So are the graphics is still clearly visible on retina screens at that size? Or should we perhaps also scale that with devicePixelRatio?

Yes they have the correct size, but you can see they’re using “non retina pixels”.
But as you’re making the images with a matrix and putImageData(), I don’t think you want to have to think about devicePixelRatio.

It’s just a constant multiplication factor, no big deal.

(mods, maybe talking about Walt/WASM should be split into its own thread by now?)

I’ve updated the Clojurescript example with the use of Sci https://observablehq.com/@jeroenvandijk/untitled/5 M

3 Likes

That is cool! I’m also working on adding support for another language to Observable. It would be very nice if there were an extensible way to e.g. syntax-highlight the code inside a cljs or html or svg block.

It would also be incredibly cool if it were possible to make ”cljs cells” the default cell type, which would mean pre-populating the text of any new cell with the template literal and placing the cursor in between the backticks.

2 Likes

6 years later now, I’m going to bump this thread which goes to the heart of my ongoing struggle with Observable. Although I’m always delighted by what I ultimately achieve with Observable, the actual process of working with JS is so joyless for me (I recognize this is mere opinion) that I dread every return to the platform. I really ought to be working on a notebook now, but I can’t even.

I’m noticing some work by @shadoof (2023) using ‘Literate CoffeeScript‘. Would anyone else be aware of ongoing progress in this or any similar (anything-but-JS) direction?

1 Like

Huge advantage is is the code is executed locally and not in a difficult to debug remote kernel. The JavaScript ‘debugger’ expression brings me joy.

That said, Notebook kit supports python and Typescript GitHub - observablehq/notebook-kit: A command-line tool for building static sites from Observable Notebooks in the reactive notebook paradigm.

TY for sharing this new development. “Seamless integration of [LLMs]” is a deal-killer tho. For me, programming isn’t some nuisance to be passed off to a statistical parrot, but an opportunity to reflect deeply on my problem. This is why I so desperately want an elegant language to express myself in.

Seeing how completely ‘AI’ has engulfed the spirit in which Observable evolves now, I feel I’ve arrived as a liberating juncture where I must start over, and retool from the ground up. I’ve noted Pluto.jl with some interest, and certainly appreciate the humanistic spirit in which it is developed; its deliberately narrowed scope (education) might however limit its applicability e.g. to general front-end dev (my main concern at this time).

Notebook Kit has no AI in it whatsoever, and Desktop’s AI is entirely optional and not enabled by default.

1 Like

I had clicked thru the 1st link, stating “Notebook Kit is available as part of Notebooks 2.0 Technology Preview,” and there found:

Our goals for a next-generation notebook editor are:

  • Seamlessly integrate AI to boost creativity, learning, and productivity

  • Streamline editing for a clean look and feel, focused on coding

Notebooks are the perfect environment for coding with AI. The instant feedback you get with reactive coding, the lightweight composability and flexibility of cells, the ability to inspect and tinker to understand what the code is doing, the infinite variety of importable open-source libraries at your fingertips — notebooks enable AI to perform as a more effective teacher and muse, inviting you to collaborate with it, rather than treating it as a black box code generator.

Eventually, this new editor and AI will be coming to the web, giving you the same great authoring experience for notebooks …

From this, I gather that Observable and I are moving in different directions, with different underlying commitments to programming craft, and that any effort I might make to hang on would be a temporizing measure at best that only postpones the inevitable.

This is all too bad, since I loved the declarative nature of d3, and it was an endless source of wonder and delight! :folded_hands: