Live data from Hacker News

JavaScript Conquered the Web, Now It’s Taking Over the Desktop

wired.com

211–220 of 270 posts

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#211
post #180

Earlier quoted context omitted.

> it gives you the simplest no-BS object/array literals you can get I really don't think that: { "foo": "bar", "baz": ["quux", 1, true] } is simpler than: ((foo bar) (baz (quux 1 true))) Quite the opposite, really.

The bottom is definitely ambiguous.

What's ambiguous? If you don't like that it's using a list to represent a map, you could always use:

    (map (foo bar)
     (baz (quux 1 true)))
But you might reflect on the fact that JSON uses an ordered sequence of bytes to represent an unordered collection of properties and values.

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#212
post #69
post #40

The salient points of the article: - People are stuffing websites into Electron and packaging it as a native application - HTML/CSS/JS is considered 'hackable' because it's widely understood by today's semi-power-user audience Although the article doesn't say it, this seems to imply that: - Full-native development unique on each platform is considered too much effort, when you can get a cross-platform app with Electr…

All of the above. If your application can be designed as a web application, you can use responsive designs and progressive enhancement techniques to create an experience that works across any platform with a web browser - with one code base. This is a pretty amazing thing, and for various business-related reasons this may seem like the right move.

The only progressive enhancement today's generation of web developers is capable of is showing a blank page if JS is turned off. Stop lying to yourselves that you care about usability or accessibility.

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#213

Earlier quoted context omitted.

> For example, it's not possible to statically determine whether a function should be inlined or not. MLton has absolutely no problems inlining functions, even higher-order functions, at compile time. This is only difficult in languages with virtual methods, because they can be overridden anywhere. If anything, that's an indictment of virtual methods, not AOT compilers. > However, a JIT can see that it's used in a ho…

> MLton has absolutely no problems inlining functions, even higher-order functions, at compile time Of course, but how does it know which functions to inline? If you inline everything, then you will blow through your cache. > What if it's a virtual method call that's known to be overridden in several places? You can't inline it, even if it's in the middle of a hot loop. That's not true--a JIT could optimistically rep…

> Of course, but how does it know which functions to inline?

Small functions and higher-order functions are the most natural candidates. (The two categories greatly overlap in most cases.)

> That's not true--a JIT could optimistically replace with a concrete realization.

You'd have to roll back an unsound optimization in the middle of a hot loop. I'm pretty sure that's not what you want.

> it is possible to speed up execution if you know what code paths you will take.

That knowledge can be encoded statically in many cases, if only you used the right languages.

> As long as it improves performance in the average case, and the worst case is bounded, then that is a net win.

This is only the case when your program wasn't close to optimal to begin with.

> You can equally well write deliberately obfuscated code that an AOT compiler has trouble with.

Yes, but languages amenable to static analysis will actively get in your way if you try to write such obfuscated code. The static analysis either tells you that your program is gibberish, or outputs nonsensical gibberish of its own. So the path of least resistance is to write code that the static analysis knows how to optimize. Which is not the case in dynamic languages (including pseudo-static ones like Java).

> Only reflection is slow. If you don't want that, don't write reflection.

So. basically, you're telling me to ditch Java's entire library and framework ecosystem?

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#214

More systems like React Native are how JavaScript should be done on the desktop rather than cordova-like things running in a node host. It has approachability but also performance and ubiquity of skill set, very little friction and is better suited for integrating native controls IMO.

React Native is part of a solid continuing trend. I've had a really good experience with the Appcelerator Titanium JS API for Android/iOS, and for the last couple versions iOS has a quality native JS API itself. Now ExponentJS has entered the ring powered by React Native and looks very very promising. When a business needs to deploy to several platforms at once, it's a quick and success-proven model that still has go…

I'm going to investigate ExponentJS as that sounds like a gap needed filling.

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#215

Earlier quoted context omitted.

There are plenty of times where you want ==, or for that matter, any falsy/truthy expression in JS... about the only points where I have issues with some of the defaults for falsy/truthy come down to the number 0... Outside that, I find that there are times where I'm dealing with inputs that can be a string or number, and the coercion can be handy. I would never suggest people start learning programming with JS first…

> There are plenty of times where you want == FWIW, I've never used ==

FWIW, I almost always use ==. Very rarely, if ever, had any problems- probably I'm used to javascript enough to think in advance of the edge cases and use === when I feel it's necessary.

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#216
post #198

Earlier quoted context omitted.

> hardly even a language. More like a collection of macros. You just described Forth, and a good portion of Lisp. Both of which are great, groundbreaking, and productive languages. > an elegant language with a few simple rules that allow for an impressive degree of freedom and flexibility Very eloquently said. However, compared to other dynamic languages like Lisp, Perl, Ruby, and Python, it doesn't strike me as part…

DSLs are actually common in javascript. JQuery, one of the most popular libraries in all of javascript is mostly a DSL for DOM manipulation. Lodash/underscore is mostly a DSL for list manipulation. Admittedly, JS doesn't have operator overloading, but I personally think that's a good thing.

Operator overloading in Python made the Pandas library possible where you can treat a DataFrame syntactically like you can in R, which is really nice for data science.

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#217

Earlier quoted context omitted.

Hmm not convinced. Is it pleasant UX that you can put petrol in your diesel car because the nozzle fits? Would it be pleasant UX to have your bank let someone withdraw money from your account without ID? Bleach bottle with no safety cap? Also the laid back kid of JS will throw a tantrum if the coffee is not a coffee. He'll throw the tantrum at your customer though (at runtime), not your developer (at compiler time).…

It would be pleasant if your engine didn't care whether you put gas or diesel in it and just ran. I think that's the point made in the cartoon. I like that the kid just holds the cup and pours it when I tell him to. If I wanted him to pour coffee and gave him a cup of beer, I'm ok saying that's my fault. I'd still rather have the kid. Having a guy that only accepts "Large cups of coffee" is necessary at lower levels…

In this analogy I'd say the engine cares in both JS and Java.

In Java you get an annoying compiler error.

In JS you get a trashed engine at runtime.

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#218

Earlier quoted context omitted.

Hmm not convinced. Is it pleasant UX that you can put petrol in your diesel car because the nozzle fits? Would it be pleasant UX to have your bank let someone withdraw money from your account without ID? Bleach bottle with no safety cap? Also the laid back kid of JS will throw a tantrum if the coffee is not a coffee. He'll throw the tantrum at your customer though (at runtime), not your developer (at compiler time).…

Considering the variety of fuel sources a diesel engine can use (oil, deisel, etc), I'd say it is pretty useful... ;-) Yeah, and good luck dealing with that remote API that now gives you an extra field in the JSON or XML, and your compiled client in a few thousand workstations needs to be updated and redeployed because of said fit.

> Yeah, and good luck dealing with that remote API that now gives you an extra field in the JSON or XML

Java C# and every other decent typed language has good serialization and deserialization support. The extra field poses no problem.

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#219

Earlier quoted context omitted.

> MLton has absolutely no problems inlining functions, even higher-order functions, at compile time Of course, but how does it know which functions to inline? If you inline everything, then you will blow through your cache. > What if it's a virtual method call that's known to be overridden in several places? You can't inline it, even if it's in the middle of a hot loop. That's not true--a JIT could optimistically rep…

> Of course, but how does it know which functions to inline? Small functions and higher-order functions are the most natural candidates. (The two categories greatly overlap in most cases.) > That's not true--a JIT could optimistically replace with a concrete realization. You'd have to roll back an unsound optimization in the middle of a hot loop. I'm pretty sure that's not what you want. > it is possible to speed up…

> Small functions and higher-order functions are the most natural candidates. (The two categories greatly overlap in most cases.)

But then you're just guessing. Isn't that also inelegant?

Let's play devil's advocate: how do you decide the cutoff on function size for inlining? Well, you would profile a bunch of programs with various cutoffs... now all you have is a heuristic, and MLton will inline some functions that it shouldn't, and it will fail to inline other functions that it should.

It will do worse than a JIT at this, because the JIT has more information.

> That knowledge can be encoded statically in many cases, if only you used the right languages.

Sure, but you won't ever succeed in encoding all of it, which is why runtime techniques can have a place.

> This is only the case when your program wasn't close to optimal to begin with.

That's simply untrue, and you can prove that formally -- given a machine M and a program P that produces outputs on a set of inputs I, it is always possible to come up with a program P' that produces those outputs with fewer steps on some subset of I, in return for taking more steps on the rest of I (except in the trivial case where the running time is completely independent of input).

You can view a JIT as iteratively replacing P with P' after it sees which inputs I are most common, and this is true no matter what M, P, or I are. In particular, there exists a version of P' that is faster than the statically optimized version of P on your program's input.

> Yes, but languages amenable to static analysis will actively get in your way if you try to write such obfuscated code.

I don't see how that isn't equally applicable to writing code to fool your JIT.

> So. basically, you're telling me to ditch Java's entire library and framework ecosystem?

Framework code doesn't generally run inside your inner loops, so I don't see how that should affect either your AOT or JIT compiler much.

Re: JavaScript Conquered the Web, Now It’s Taking Over the Desktop

#220
post #95

Earlier quoted context omitted.

> Let's just call this experiment a failure The problem with "just calling this experiment a failure"—why that won't work in practice—is that JavaScript is not a failure. It's extremely successful.

And it is extremely successful because it's not a bad language. Sure, there's lots of "wat", but a non-professional programmer is going to say "wat" about every strange error they get from another programming language that js would have just passed silently with a weird result. Then they will replace whatever construct isn't working with one that does, and get on with their life, unlike people who seem to have a lot…

>about every strange error they get from another programming language that js would have just passed silently with a weird result

Wait, do you mean to imply that "passing silently with a weird result" is somehow better than throwing a verbose, descriptive error?

Post reply on HN