[Python-ideas] Towards harmony with JavaScript?
Chris Angelico
rosuav at gmail.com
Fri Aug 11 15:19:37 EDT 2017
On Sat, Aug 12, 2017 at 5:13 AM, Alberto Berti <alberto at metapensiero.it> wrote:
> Chris> What do you do about all the places where the languages have
> Chris> significantly different semantics? For instance, a Python integer can
> Chris> store more values than a Python float (which is broadly compatible
> Chris> with a JS Number), but in JS, bitwise operations restrict the value to
> Chris> 32-bit.
>
> As of now, I do nothing. As I said, the goal of the tool is not to
> shield you from JS, for this reason it's not meant for beginners (in
> both JS or Python). You always manipulate JS objects, but allows you to
> to be naive on all that plethora of JS idiosyncrasies (from a Python pow
> at least) that you have to think about when you frequently switch from
> python to js.
>
> Chris> Transpiling is an
> Chris> extremely dangerous thing to do a partial job of.
>
> Even breathing can be dangerous in some environments...
> Bridging two different concepts together is always a partial job...
>
> Again, the use case may seem minimal to you but I can assure that it
> helps on the day to day work with JS.
Speaking as someone whose day job is teaching Python and JavaScript, I
don't like the idea of this kind of thing. You're bringing (some)
Python syntax, but sticking to JS semantics. That means your source
code looks like Python, but runs like JS. You can't afford to ever run
it through a Python interpreter (the semantics will be wrong).
There's already plenty of confusion in the world. I don't want to add
more. It would be far better to base your language on JS syntax, since
it's using JS semantics; just add in a handful of Python features that
you really miss.
ChrisA
More information about the Python-ideas
mailing list