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

Using RapydScript-ng in the browser #12

Closed
BruceSherwood opened this issue Mar 12, 2016 · 10 comments
Closed

Using RapydScript-ng in the browser #12

BruceSherwood opened this issue Mar 12, 2016 · 10 comments

Comments

@BruceSherwood
Copy link

I'm submitting this issue in order to make contact with you, not knowing your email address. I'm the developer of glowscript.org, which uses Tsepkov RapydScript to permit users to write Python programs that generate real-time navigable 3D animations extremely easily. For example, the one-line program "box()" creates a WebGL canvas, displays a white cube at the origin, provides useful lighting, positions the camera so that the box fills the screen, and turns on mouse controls for zooming and rotating the camera. Programs can be written and run even on mobile devices. See the Example programs at glowscript.org.

I like very much the enhancements you have made and would like to use your version of RS, and like you I'm concerned that evidently Tsepkov now has little time to devote to improving RS. I had difficulties using standard RS in the client and have no interest in using it in a server or with node. I would be thrilled if you could tell me how to use your version of RS in the browser. Thanks much.

Bruce Sherwood ([email protected])

P.S. I taught at Caltech 1966-1969, then switched to college physics education, including the use of computers.

@BruceSherwood
Copy link
Author

At http://www.glowscript.org/#/user/Bruce_Sherwood/folder/My_Programs/program/Users you can see what a huge impact RapydScript had on the use of glowscript.org. Previous to using RS, users had to write their 3D programs in JavaScript or CoffeeScript. The recent rapid rise in the number of users coincided with the introduction of VPython as an easier option. (One can also write programs in RapydScript, the distinction being that a GlowScript RapydScript program follows closely the API of GlowScript JavaScript programs, whereas GlowScript VPython programs involve some preprocessing to support the VPython API.)

@kovidgoyal
Copy link
Owner

I'm not sure exactly what you are asking for. The most straight forward way to use RS-ng in the browser is to write you code in rapydscript and compile it to a javascript file and include the javascript file in your webpage.

Do you mean you want to include the compiler itself in the browser and have it compile RS code to JavaScript on the fly?

@kovidgoyal
Copy link
Owner

Oh and I was at Caltech from 2003-1009 in the Particle Theory Group -- long after your time there I'm afraid :)

@BruceSherwood
Copy link
Author

BruceSherwood commented Mar 13, 2016 via email

@kovidgoyal
Copy link
Owner

RS-ng is designed from the ground up to be used in different contexts, so this should be easy enough. In fact, I am currently working on a LIVE (in browser) REPL (read-eval-print-loop) for RS-ng. If you checkout this repo from github, you can try it for yourself. Run

bin/web-repl-export /path/to/some/empty/directory

Then point your browser to
file:///path/to/some/empty/directory/index.html

@kovidgoyal
Copy link
Owner

A couple of caveats about the in browser REPL

  1. It needs a modern (ES6) capable browser -- so no internet explorer
  2. importing modules only works for stdlib modules you cannot import arbitrary modules

@BruceSherwood
Copy link
Author

BruceSherwood commented Mar 13, 2016 via email

@kovidgoyal
Copy link
Owner

Ah, windows. bin/web-repl-export refers to the web-repl-export file in the bin subdirectory of this repo. To execute it on windows, you'd need to run

node bin/web-repl-export (assuming you have installed node.js and it is on your path).

As for non-ES6 runtimes, adding support for that would increase the size of the embedded compiler from 600KB to 6MB -- really not something I'd recommend doing.

@BruceSherwood
Copy link
Author

BruceSherwood commented Mar 13, 2016 via email

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