Comments (16)
Well the problem is that in python3 range() does not actually give a standard iterator, but a special object that apparently restarts after reaching the end, and has some special methods, like count() and index(). I suppose one could implement this in rs-ng as well.
from rapydscript-ng.
I believe that originally in CPython range(N) actually produced a list of length N. This has obvious disadvantages, but it would be a simple implementation while considering a more elegant solution (maybe this is what RS does, since it works there). In any case, this does seem a rather significant departure from CPython, and an unexpected one, so it would be great if you see a way to implement it.
from rapydscript-ng.
Sure, I'm not saying it should not be fixed. It will just be a little while before I can get to it. In the meantime, you can always change the implementation of range in baselib-builtins.pyj for yourself to use an array.
from rapydscript-ng.
I tried the obvious changes, namely to replace the RS_range function in the run-time package and in the in-browser compiler, to construct a list, but then compiling doesn't work at all. I see that the range function is used for various purposes in the in-browser compiler, so maybe that's why I can't make the change?
from rapydscript-ng.
I've already fixed this.
from rapydscript-ng.
That's terrific (you're incredibly responsive!), but how do I recreate the in-browser compiler, which is still 0.7.11? The only way I know to get a new in-browser compiler is to go to
https://kovidgoyal.github.io/rapydscript/repl/rapydscript.js
from rapydscript-ng.
How to build the embedded compiler is documented in the readme
from rapydscript-ng.
I really appreciate the documentation you provide on installing etc. Many repositories provide little such information.
I had been using "npm install rapydscript-ng" followed by executing "rapydscript --bare input.py > runtime.js", where input.py just contains "a = 1", then deleting the last few lines, as you had explsined, and I obtained the mebedded compiler from kovidgoyal.github.io/rapydscript/repl/rapydscript.js. However, following that procedure didn't get me the changes to range(), so I built from source (on my Mac; bin/web-repl-export fails on my primary machine, a Windows 10 desktop). I'm curious:
-
What triggers an update to kovidgoyal.github.io/rapydscript/repl/rapydscript.js?
-
Under what circumstances will "npm install rapydscript-ng" not pick up the latest state of the repository?
from rapydscript-ng.
-
a version bump
-
whenever there have been commits after the last version bump
from rapydscript-ng.
Thanks.
When I built yesterday from source, I assumed that dev/baselib-plain-pretty.js would be the runtime file I needed (previously I ran rapydscript on "a=1" as you had explained to me). What I found was that the following preamble was missing from the start of dev/baselib-plain-pretty.js:
var ρσ_iterator_symbol = (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") ? Symbol.iterator : "iterator-Symbol-5d0927e5554349048cf0e3762a228256";
var ρσ_kwargs_symbol = (typeof Symbol === "function") ? Symbol("kwargs-object") : "kwargs-object-Symbol-5d0927e5554349048cf0e3762a228256";
var ρσ_cond_temp, ρσ_expr_temp, ρσ_last_exception;
var ρσ_object_counter = 0;
var ρσ_len;
Is there some other file obtainable when working with the source that includes these essential definitions? Or should I have again run rapydscript on "a=1"?
from rapydscript-ng.
To generate rapydscript.js just do:
./build
./bin/web-repl-export out
File is out/rapydscript.js
In any case I have updated the online one manually, so you can just use that.
from rapydscript-ng.
I did run web-repl-export and picked up embedded_compiler/rapydscript.js. That's not the issue; the issue was how to construct the runtime library. I made the guess that it would be dev/baselib-plain-pretty.js, but in fact that file doesn't define ρσ_iterator_symbol, etc. Those five lines are the only pieces missing from using dev/baselib-plain-pretty.js as the runtime library.
from rapydscript-ng.
Oh sorry (I've been rather swamped because I just released a new project to the public https://github.com/kovidgoyal/kitty so I did not pay as much attention as I should have) -- yeah you need to do the run trick again.
from rapydscript-ng.
I found that I didn't understand how to "do the run trick" when working with the source. If I execute "rapydscript --bare input.py > runtime.js" I don't get the most recent changes. Presumably I need to use not "rapydscript" but dev/compiler.js, but I couldn't figure out in the node environment what command to issue.
from rapydscript-ng.
First uninstall any previous rapydscript you have installed with npm. Then run
git clone git://github.com/kovidgoyal/rapydscript-ng.git
cd rapydscript-ng
sudo npm link . # this will link the rapydscript executable to the current dir
npm install # This will automatically install the dependencies for RapydScript
from rapydscript-ng.
I'll try again, but I've always installed rapydscript locally, in its own initially empty directory. After executing the four statements you quote, my experience was that "rapydscript --bare input.py > runtime.js" didn't get the most recent changes, which is why I thought I had to invoke rapydscript a different way, maybe invoking the compiler in dev.
from rapydscript-ng.
Related Issues (20)
- Import problem? HOT 4
- class decorator bug HOT 5
- when converting .children() to list, i get list of empty dictionaries HOT 4
- Remove typing/annotations from input HOT 1
- Ellipsis HOT 7
- bitops on booleans HOT 1
- string.split() HOT 3
- random.randint tolerates 3rd argument HOT 3
- distionary += error HOT 21
- Build question HOT 5
- pop for dict, pypop for list HOT 8
- Idle curiosity about duplication HOT 1
- Missing element from rapydscript.js?
- Mistranspilation HOT 2
- Remove a list from a list HOT 4
- while/else HOT 3
- randrange error
- Function argument handling
- Comical Bundle Size HOT 1
- Large slowdown HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rapydscript-ng.