Live data from Hacker News

Should JavaScript be split into two languages?

devclass.com

281–290 of 324 posts

Re: Should JavaScript be split into two languages?

#281
post #252
post #242

Earlier quoted context omitted.

I wonder what the response would've been if I had left the WAT source code out and just claimed, "this WASM binary was built with a compiler", and not specified the language.

i would have liked to see the source. how would the example look like when written in python for example? and how would it compare with non-wasm javascript?

> how would the example look like when written in python for example?

That seems like an easy question, but there a lot of choices which complicate it. I'm sure people have compiled CPython to WebAssembly, but I think you only get the WebAssembly imports they (or Emscripten) have chosen for you. I can't use that as an example of what I was trying to show.

It looks like py2wasm is aiming for a true Python to WASM compiler, rather than compiling an interpreter. However, I don't think it supports user-defined imports/exports yet. There's a recent issue thread about this (https://github.com/wasmerio/py2wasm/issues/5).

> how would it compare with non-wasm javascript?

I'm not sure I understand the question. If you're just using JavaScript, it just looks like JavaScript.

Re: Should JavaScript be split into two languages?

#282
post #280

Earlier quoted context omitted.

The specific type of conversion is one I don't see as a big issue. The programmer deliberately decided to use an imprecise data type for the calculation. But more importantly, I'm saying that the problematic rounding can occur even if your tower does not have both bigint and float. It can happen even if every layer can completely represent every value of the layer above it. Do you have any complaints that are unique…

From a distance, I kind of like Scheme, so I went and re-read the R5RS section on the topic. To me, the numeric tower (generalized) says: N That's a nice statement about idealized sets of numeric values. So `integer?` implies `rational?` implies `real?` implies `complex?` implies `number?` in Scheme predicates and type conversions. But no programming language can have "Reals" (they aren't computable), so floats are a…

> But it's not much of a tower, and it's more of a collection DAGs.

> I'm trying to criticize something about pretending they are subtypes/subsets. Claiming it's a tower and hand waving about exact/inexact doesn't make it a tower

I thought we established right away that it's not a single tower. The description in the wikipedia page is two towers with links between them. (Or at least it's two if you don't waste effort on things like having both float64 and complex32.)

But I don't see any hand waving. The relationships and conversions are very clear. That's why I interpreted your complaint as being more about the specific operation. So with your correction, I need you to explain where you see hand-waving.

If you just don't like the name "Tower" for an implementation that has both bignums and floats then okay I agree I guess?

Re: Should JavaScript be split into two languages?

#283
post #281
post #252

Earlier quoted context omitted.

i would have liked to see the source. how would the example look like when written in python for example? and how would it compare with non-wasm javascript?

> how would the example look like when written in python for example? That seems like an easy question, but there a lot of choices which complicate it. I'm sure people have compiled CPython to WebAssembly, but I think you only get the WebAssembly imports they (or Emscripten) have chosen for you. I can't use that as an example of what I was trying to show. It looks like py2wasm is aiming for a true Python to WASM comp…

so does that mean accessing the DOM from python is not possible yet?

for the second question the example you gave is equivalent to what in plain html/js?

Re: Should JavaScript be split into two languages?

#284
post #280

Earlier quoted context omitted.

From a distance, I kind of like Scheme, so I went and re-read the R5RS section on the topic. To me, the numeric tower (generalized) says: N That's a nice statement about idealized sets of numeric values. So `integer?` implies `rational?` implies `real?` implies `complex?` implies `number?` in Scheme predicates and type conversions. But no programming language can have "Reals" (they aren't computable), so floats are a…

> But it's not much of a tower, and it's more of a collection DAGs. > I'm trying to criticize something about pretending they are subtypes/subsets. Claiming it's a tower and hand waving about exact/inexact doesn't make it a tower I thought we established right away that it's not a single tower. The description in the wikipedia page is two towers with links between them. (Or at least it's two if you don't waste effort…

> I thought we established right away that it's not a single tower.

Where did we say that? The first picture on the Wikipedia page shows the tower as a linear stack of items from set theory. The Scheme predicates are named similarly. This is the appealing myth.

> The description in the wikipedia page is two towers with links between them.

Not on the page I'm seeing. Are you reading the English page? At the bottom, I see a tree of abstract types (sets).

This shows that you can traverse (Integer to Rational to Real) and (Float to Real) to find the common abstract type Real. But there isn't actually a Real type you can do operations with. You've got concrete BigInt and Float64, and even if Real is implemented as a C-style tagged-union of the two types, you still need to pick one or the other for doing operations like addition. Then the Scheme standard says stuff like, "try to be exact when you can, but inexact is ok sometimes". So all the set theory justification is out the window, and it's really just an ad hoc rule.

It's just not as elegant as it seems, and it gives an unsound justification to making implicit conversions.

> If you just don't like the name "Tower" then okay I agree I guess?

Please don't do that. I've tried to clarify details in response to your questions, but if you're just going to dismiss it with some snarky crap like that then you can go fuck yourself.

Reply if you want, but I'm guessing we're done here.

Re: Should JavaScript be split into two languages?

#285
post #283
post #281

Earlier quoted context omitted.

> how would the example look like when written in python for example? That seems like an easy question, but there a lot of choices which complicate it. I'm sure people have compiled CPython to WebAssembly, but I think you only get the WebAssembly imports they (or Emscripten) have chosen for you. I can't use that as an example of what I was trying to show. It looks like py2wasm is aiming for a true Python to WASM comp…

so does that mean accessing the DOM from python is not possible yet? for the second question the example you gave is equivalent to what in plain html/js?

> so does that mean accessing the DOM from python is not possible yet?

No. It means you only get what the person who ported CPython or py2wasm gave you. It's not a limitation in WebAssembly, and maybe they have some other (hopefully better) API than the `easy(123)` example I was trying to show.

> for the second question the example you gave is equivalent to what in plain html/js?

If I understand what you're asking, it's just:

    plain jane
    

    function easy(arg) { 
        const div = document.createElement("div"); 
        div.textContent = "DOM this: " + String(arg); 
        document.body.appendChild(div); 
    }

    easy(123);
    easy(456);

    

Re: Should JavaScript be split into two languages?

#286
post #279
post #270

Earlier quoted context omitted.

Most devs do know what Lisp'ish languages are because you just can't forget how weird a bunch of nested parenthesis look. They just don't care enough to invest time in it because it is niche. And proponents tend to tirelessly spam about it from their ivory towers like it's flawless and everyone who didn't learn it is somehow inferior, somehow justifying personal attacks like yours. Classy as usual.

[flagged]

If you think people who chose not to learn a language you like are insecure it tells more about you than about them.

Re: Should JavaScript be split into two languages?

#287
post #271

Earlier quoted context omitted.

Exactly. I, like most devs, know what Lisp is. I, like most devs, just don't care.

[flagged]

Sorry to bust your minuscule lisp bubble but just because someone ignored your favorite niche language in an educated career choice, it doesn't mean they are ignorant.

Infantile language tribalism though, have no place in engineering and is blatant ignorance when coming from a supposed adult.

Re: Should JavaScript be split into two languages?

#288
post #258

Earlier quoted context omitted.

My point is that if someone says something is arcane, “it’s not, it’s just [something that you’ve potentially never heard of and almost definitely don’t understand even if you have heard of it]” doesn’t help your case. They could look it up, but the fact that they would have to do so proves the commenter’s point - relatively few programmers understand Lisp syntax, i.e. it is arcane. If you’re trying to raise awarenes…

There's nothing "arcane" about WebAssembly Text format. The fact that you don't recognize it just means you don't know much about WebAssembly, which is fine, but you're whining, lashing out, and attacking people who are trying to explain it, and trying to police and derail discussions between other people who are more knowledgeable and interested in it, which makes you a rude anti-intellectual asshole. Why don't you…

> you’re whining, lashing out, and attacking people who are trying to explain it

I think you’re assuming that all of the comments you’re talking about are written by the same person, when they’re not. I haven’t been attacking anyone, and I don’t think I’ve replied to anyone who’s tried to explain it.

> things you purposefully know nothing about and refuse to learn

Why do you still assume I don’t know what they are? I’ve already pointed out that my belief that s-expressions are arcane doesn’t mean I don’t know what they are.

As another illustration of my point, I just stumbled across this comment on another post:

> But maybe the whole "ease of use" budget is blown by using a Lisp in the first place.[0]

The fact is that Lisp syntax is understood by relatively few programmers, which meets the definition of arcane. You immediately flying off the handle when someone calmly points this out will not help your goal.

[0] https://news.ycombinator.com/item?id=41965178

Re: Should JavaScript be split into two languages?

#289
post #287

Earlier quoted context omitted.

[flagged]

Sorry to bust your minuscule lisp bubble but just because someone ignored your favorite niche language in an educated career choice, it doesn't mean they are ignorant. Infantile language tribalism though, have no place in engineering and is blatant ignorance when coming from a supposed adult.

If it's about career choices, people skills and charisma will get you further than any technical decisions you might make.

Re: Should JavaScript be split into two languages?

#290
post #271

Earlier quoted context omitted.

Exactly. I, like most devs, know what Lisp is. I, like most devs, just don't care.

[flagged]

> There's no point in trying to make other people stop talking about Lisp

Nobody is trying to make you stop talking about it. We’re trying to make you understand that the way you’re talking about it is elitist. When someone said they were confused by the syntax, you could have just explained it without judgement. Instead, you felt compelled to flaunt your membership of the in-group who understands Lisp, and try to make others feel stupid by implying that people who don’t understand it aren’t good programmers, or are anti-intellectual.

You’re doubling down on it in this comment, too, still insistent on making people feel like they’re “less than” because they don’t know Lisp:

> so other more knowledgeable and curious people

If I didn’t know Lisp, and my first exposure to it was from someone who sees this kind of toxicity as a reasonable way to speak to people, would I want to join their community?

Post reply on HN