TypeCellOS / TypeCell

https://www.typecell.org
GNU Affero General Public License v3.0
444 stars 29 forks source link

Proposal: Language and Framework Agnostic #358

Open snowyu opened 1 year ago

snowyu commented 1 year ago

Objective:

The objective of this proposal is to enable the usage of any framework and programming language within a typecell notebook.

First a Minimal Runtime to Bootstrap

Develop a minimal runtime environment that serves as a foundation for executing code in a typecell notebook.

The runtime should provide the necessary infrastructure to support language and framework agnosticism:

...

YousefED commented 1 year ago

I would love to see this happen. Which languages are you interested in particularly?

Other things that will need to be taken into consideration:

snowyu commented 1 year ago

I personally am interested in CoffeeScript because it may be simpler for common users and it is also a simple language itself.

Reactive runtime: how does the language detect "dependencies" across cells, that force recalculations?

In the minimal runtime notebook, we don't need to consider reactive runtime. Instead, we can bootstrap by starting with a minimal runtime support for typecell notebooks. We begin with the simplest dynamic compiler library and use it to develop a notebook library for reactive runtime specifically for Vue and React(We can even directly develop web components using notebooks). This way, regular typecell notebooks can simply use these reactive runtime notebook libraries. This allows for the creation of front-end interactive applications using typecell notebook.

How to abstract the reactivity? Perhaps abstract reactivity may not be necessary at all since each framework has its own built-in mechanisms for achieving reactivity.


## Writing the reactive runtime using the TypeCell notebook itself

```ts
class VueTypeCell extends AbstractReactivity {

}

// register to typecell system
VueTypeCell.register()

```

The problem is howto bootstrap the renderer.


## Writing the renderer using the TypeCell notebook itself

```ts
class MyRenderer extends AbstractRenderer {

}

// register the renderer to typecell system
MyRenderer.register()

```