Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Language and Framework Agnostic #358

Open
snowyu opened this issue Sep 5, 2023 · 2 comments
Open

Proposal: Language and Framework Agnostic #358

snowyu opened this issue Sep 5, 2023 · 2 comments

Comments

@snowyu
Copy link

snowyu commented Sep 5, 2023

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:

  • Dynamic Compiler Library:
    The dynamic compiler library acts as a proxy factory for various compilers in different programming languages.
    Developers can register compilers for different languages and different importers within the library.
    The library facilitates the execution of code through import statements, enabling the use of specific importers.
    For example, developers can use statements like import vue from ... or import react from ... to ensure framework agnosticism.
  • iframe Sandbox:
    The compiled code will be executed within an iframe, providing a secure and isolated environment.

...

@YousefED
Copy link
Collaborator

YousefED commented Sep 5, 2023

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

Other things that will need to be taken into consideration:

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

@snowyu
Copy link
Author

snowyu commented Sep 6, 2023

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()

```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants