Code Monkey home page Code Monkey logo

Comments (6)

atsepkov avatar atsepkov commented on July 20, 2024

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.

helambuapps avatar helambuapps commented on July 20, 2024

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.

atsepkov avatar atsepkov commented on July 20, 2024

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.

helambuapps avatar helambuapps commented on July 20, 2024

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.

adousen avatar adousen commented on July 20, 2024

@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.

helambuapps avatar helambuapps commented on July 20, 2024

Thanks for the link. I will have a look when I get a chance. :)

from rapydscript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.