News for hackers. Stuff that matters.
Re:KV Storage, the Web's First Built-In Module by networkimprov on Tuesday March 12, 2019 @01:18AM (#19365616)
The bigger story here appears to be a "Javascript Standard Library" which is summarized [1] without any list of proposed modules/packages...

A key-value store isn't quite the first module that leaps to mind for such a toolkit :-)

EDIT: found a collection of module proposals! [2]

[1] https://github.com/tc39/proposal-javascript-standard-library

[2] https://github.com/tc39/proposal-javascript-standard-library...

Re:KV Storage, the Web's First Built-In Module by garyclarke27 on Tuesday March 12, 2019 @04:32AM (#19366312)
Agreed - Javascript Standard Library - is a simple but brilliant idea. Optional, so nobody is forced to use it, but if a library has useful functionality, seems to me to be a no-brainer to me to use such, likely to be higher quality and more performant. Let’s hope they can bring back WebSQL as such a library, Microsoft and Firefox’s appalling decision to drop the amazing SQLite from browsers and force in the inferior IndexDB, needs to be reversed. A local RDBMS is required, to enable PWAs to more easily match desktop capability.
Re:KV Storage, the Web's First Built-In Module by virtualwhys on Tuesday March 12, 2019 @04:55AM (#19366391)
> Let’s hope they can bring back WebSQL

Agreed, although having the implementation defined exclusively by Sqlite (which is why IndexedDB became the standard browser database) remains a rather large sticking point.

Aside from the standards group reverting the deprecation of WebSQL, Firefox adoption has dwindled to dangerous lows, and Microsoft now bases their browser on Chrome, so in the not too distant future one could simply target the dominant browsers, Chrome and Safari, and use WebSQL, deprecated or not (if in 10 years Chrome and Safari haven't removed WebSQL, when will they?).

Unlikely WebSQL will make a comeback though, frontend devs seem to like NoSQL-style structured data, which maps well to JavaScript object notation. Would be great to write the same relational SQL on server and client, but that's a pipe dream unless a drastic shift in standards committe direction happens.

Re:KV Storage, the Web's First Built-In Module by benjaminjackman on Tuesday March 12, 2019 @08:19AM (#19367402)
Maybe it will be possible to compile Sqlite to wasm and then using indexdb as a backing store for it. In which case perhaps a good enough polyfill would be accessible to Firefox.
Re:KV Storage, the Web's First Built-In Module by virtualwhys on Tuesday March 12, 2019 @11:25PM (#19375436)
The issue there is that each client/user has to download the wasm binary, unlike WebSQL where Sqlite comes bundled with the browser for free -- there are issues there as well, versioning/security, but not having to download anything is pretty nice, like the KV storage option, it's there to use immediately, no download, no parsing overhead.
Re:KV Storage, the Web's First Built-In Module by bradleyjg on Tuesday March 12, 2019 @07:22AM (#19367059)
Does anyone use non-mobile safari?
Re:KV Storage, the Web's First Built-In Module by acdha on Tuesday March 12, 2019 @09:33AM (#19367925)
On a fairly broad-interest site I just checked, Safari is the second most-popular browser behind Chrome. Even if you exclude iOS, which doesn't make sense for most sites, it's in the same range as either Internet Explorer or Edge.
Re:KV Storage, the Web's First Built-In Module by scarface74 on Tuesday March 12, 2019 @09:20AM (#19367815)
Yes and even though you haven’t owned a TV in 15 years,people still watch TV too....
Re:KV Storage, the Web's First Built-In Module by acdha on Tuesday March 12, 2019 @09:28AM (#19367877)
WebSQL is an interesting case: I like the capabilities it offers but it wasn't standardized more than “whatever a particular version of SQLite does” and that lead to things like https://blade.tencent.com/magellan/ because the attack surface was broader than anticipated.

I'd like it to come back but also in a more considered form with some API improvements — exactly the kind of thing you'd get out of it going through the standards process with more than one implementation.

Re:KV Storage, the Web's First Built-In Module by Nimelrian on Tuesday March 12, 2019 @03:37AM (#19366113)
I recommend reading through this issue [1]. It's amazing how much the JS community is firing against a bigger standard library, just because stuff like lodash exists and everyone can make their own packages anyways.

[1] https://github.com/tc39/proposal-javascript-standard-library...

Re:KV Storage, the Web's First Built-In Module by simias on Tuesday March 12, 2019 @07:28AM (#19367096)
As a (mostly) C dev this is like bizarro world to me but I've noticed on HN and elsewhere that JS devs are very quick to move from one framework to an other, declaring a library dead if it hasn't received a significant update in mere months. I'm sure that there are plenty of JS devs out there who have fundamentally changed the way they code several times over the past few years.

With this mindset I can understand that there might be some reluctance to consider a standard library that would be "set in stone" and shape the language basically forever (and potentially create a burden of legacy feature that needs to be maintained, C++ style).

Re:KV Storage, the Web's First Built-In Module by andreareina on Tuesday March 12, 2019 @09:41AM (#19368005)
That's going to happen whether they expand the stdlib or not. Witness Array.prototype.flat() (because .flatten() would break websites using MooTools). I think the staged process they use and compilers like Babel work to get the proposed API in use so it can be evaluated against actual in-the-wild use, without contributing to ossification.
Re:KV Storage, the Web's First Built-In Module by CyberDildonics on Tuesday March 12, 2019 @10:39AM (#19368547)
You know what they say: If it ain't broke, let's move to a brand new framework.
Re:KV Storage, the Web's First Built-In Module by sametmax on Tuesday March 12, 2019 @04:02AM (#19366194)
Yeah, why get an uniform experience when you can have a different hard time in each new code base ?

Why have basic features defined such as namespace, hashing, basic data structures manipulation, and uuid when you can have the unpleasure of rewritting it everytime ?

Why avoid making your users download primitives they have a 100 copies of on their machines in all those dll and so ?

It's not like those are solved problems in all other languages that don't have an accidental monopoly on the Web.

Re:KV Storage, the Web's First Built-In Module by bryanrasmussen on Tuesday March 12, 2019 @04:26AM (#19366286)
somewhat cynical/defeatist: Because those languages came along at a time previous to the web era and were often ruled by a single entity but in the web era XKCD standards rules https://xkcd.com/927/
Re:KV Storage, the Web's First Built-In Module by gambler on Tuesday March 12, 2019 @12:22PM (#19369824)
I wonder how many of those people rallying against a standard library ever had to support a legacy codebase where all the design decisions were made by someone else. Doesn't sound like they have that kind of experience at all.

Funny thing is, eventually Google will decide that they do need a standard library and all those freedom fighters will do a 180 flip in terms of what they support. This already happened so many times in the community. (Classes being the most notorious example. I'm not saying Google was behind them, but there was a definite 180 flip on whether classes were needed.)

Maybe this is the first step towards Google establishing a standard library.

Re:KV Storage, the Web's First Built-In Module by snek on Tuesday March 12, 2019 @11:54AM (#19369435)
Just to be clear, the "JavaScript Standard Library" and the "Web Standard Library" are completely separate. (they are worked on by a lot of the same people though)