Comments (6)
There is no easy way to fix alert
issue without making the language uglier, unfortunately. I would need to overload the '+' operator, which will introduce overhead to native JS. One of the biggest selling points of RapydScript to Skulpt, etc. is performance, and I want to keep it that way.
The second problem will be addressed by issue #22, which I should update. I've been hesitant about it since that would make is
operator worthless, but I could map that to Object.is
, which to me doesn't seem all that useful.
from rapydscript.
I reckon, One of the main reasons people love to avoid writing Javascripts by hand and use tools/languages like JSX, Javascript++, Coffeescript, ASM.js etc etc is to avoid this sort of problems.
AFAIK Javascript has problems concatenating arrays and dictionaries. If I were you I would overload the '+' operator only for arrays and dictionaries. Also I would do some sort of evaluation of data types on the RHS and LHS of the '+' operator and throw an error if they are of different types.
I don't know how easy it is but it doesn't look pythonic enough and it is obviously misleading to add arrays and return a string.
Otherwise Rapydscript is just going to be the same old Javascript with an illusion of Python syntax.
from rapydscript.
You can't selectively overload an operator in a dynamically-typed language. It's impossible to know whether the arguments will be arrays or something different until run time. Here is a simple example:
def func(a, b):
return a + b
The compiler doesn't know whether a and b are arrays or not. If you overload the operator, you have to overload it for all cases. In which case the JavaScript will always look like add(a, b). This has been brought up several times on our mailing list, it's simply not feasible. Debugging the language in the browser will become a pain, all arithmetic will become much slower than in JavaScript due to the extra overhead. This has already been done in the past, by a project called Pyjamas, and it failed miserably precisely for the reasons I just mentioned.
There is no illusion here. I never claimed that RapydScript is Python, in fact I make it very clear in the first paragraph of the documentation that it is not. That same paragraph also states actual differences between RapydScript and JavaScript as bullet points. If you don't agree that that makes the language more convenient than native JS, you don't have to use it, but your argument that the language is the same as JavaScript is incorrect - the bullets explain why.
from rapydscript.
I agree with you. I believe it is an extremely difficult engineering challenge and doesn't worth to do it. It may be easier to compile the Python language itself using Native Client or ASM.js.
Do you have a tool similar to Jsline? I don't know may be a Rapyd Script Lint?
from rapydscript.
@helambuapps You can have a look at Facebook's Flow,a static type checker, designed to find type errors in JavaScript programs. Type annotations in Flow is similar to Python3.
from rapydscript.
Thanks for the link. I will have a look when I get a chance. :)
from rapydscript.
Related Issues (20)
- append method does not compile to js push method HOT 1
- VSCode extension for syntax highlighting HOT 4
- cannot compare string HOT 3
- Typescript has problem compile RS --es6 output at class attributes HOT 2
- Why not support in-browser compiler? HOT 2
- enhancement: check for already reserved words like: enum HOT 18
- Cannot resolve python imports HOT 8
- Is that possible to parse python code to js AST? HOT 1
- fstring support. HOT 1
- How to keep all comments HOT 8
- Can't find python module that is installed and available? HOT 1
- Cannot catch ImportError HOT 2
- Cannot import from custom module in different directory HOT 5
- How to use RapydScript with JavaScript MutationObserver HOT 1
- Question about feasibility: option to use JS function syntax for nested functions, especially inside dicts/object-literals HOT 7
- How to run code snippets from tutorials on old Android? HOT 1
- Computed and negative slices
- parenthesized syntax HOT 2
- TypeError: undefined is not a function HOT 1
- Compiler issues HOT 1
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.