News for hackers. Stuff that matters.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by franciscop on Thursday April 06, 2017 @09:48PM (#14056413)
I am not sure I like some of the new changes. It seems to me like JS is expanding both towards an upper level language and a lower level language, which frankly makes it look more like a Frankenlanguage. I guess it's the limitations of having a single real language to be used in the browsers.

Edit: just check this tutorial. I'd venture to guess to 99% of JS developers it sounds totally bizarre: https://github.com/tc39/ecmascript_sharedmem/blob/master/TUT...

Re:Blink-dev – Intent to Ship: SharedArrayBuffer by zensavona on Thursday April 06, 2017 @10:01PM (#14056478)
But that is exactly what is needed. JavaScript is essentially a becoming a ~native~ language (like C, C++, Java) which is used to implement all kinds of abstractions.

Think of C++ for example. It's used to implement frameworks like JUCE, used for high-level application logic and UIs, but underneath that there are a lot of optimised abstractions. Some of these abstractions can only be so good or so deep until the language they are implemented in can get closer to the "metal" (or in this instance, VM).

I for one welcome these new additions to the ECMAscript spec.

Re:Blink-dev – Intent to Ship: SharedArrayBuffer by vvanders on Thursday April 06, 2017 @10:22PM (#14056581)
> ... ~native~ language (like C, C++, Java)

One of those is not like the others.

Re:Blink-dev – Intent to Ship: SharedArrayBuffer by stymaar on Friday April 07, 2017 @02:03AM (#14057485)
Surprisingly enough, Java is a native language in some parts of the embeded world (see smart cards for instance, but not only [1]).

[1]: https://en.m.wikipedia.org/wiki/Java_processor

Re:Blink-dev – Intent to Ship: SharedArrayBuffer by fulafel on Friday April 07, 2017 @12:34PM (#14061157)
Also Android.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by fulafel on Thursday April 06, 2017 @11:42PM (#14056925)
C++ was OS-native on some older now extinct systems, like Symbian and BeOS.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by metaobject on Thursday April 06, 2017 @11:52PM (#14056976)
I think he's talking about Java
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by josefx on Friday April 07, 2017 @10:19AM (#14059825)
There are coprocessors that run Java Bytecode directly. Is there actually an implementation of the machine outlined in the C standard? Clearly C is an abstraction while Java is a truly native language.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by voxic11 on Friday April 07, 2017 @10:57AM (#14060202)
Well those processors just run bytecode compiled from Java source code. The same is true of more traditional processors they just run bytecode compiled from c source code. I thicnk they are both doing essentially the same thing.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by josefx on Friday April 07, 2017 @01:49PM (#14061894)
So what are the properties of C bytecode? Other than undefined, implementation defined and format C:\\ ? Java specifies a high level language, the low level bytecode and a target machine while C has to abstract over the byte code and large parts of the machine, leaving it up to the developer to fight countless "implementations". Guaranteeing that the same code is simultaneously right, wrong and file not found while limiting access to features exposed by the underlying "bytecode" in ways that require software workarounds like fmadd that are used in place of hardware.

Clearly the Java language -> Java bytecode -> Java Hardware chain is inherently more native and consistent than C language -> C Virtual Machine -> x64 -> Intel Core 2, where each step in the C language chain looses access to features of the underlying layer.

Re:Blink-dev – Intent to Ship: SharedArrayBuffer by franciscop on Thursday April 06, 2017 @10:14PM (#14056550)
But not really, Javascript has to be interpreted/JITed, so it will never be in the same level as C/C++. IMO it'd be way better to:

- Introduce real native types, not complex-named functions that are way more bothersome to work with than types.

- Use WASM or something similar to provide for a low level variant.

Re:Blink-dev – Intent to Ship: SharedArrayBuffer by foota on Thursday April 06, 2017 @11:50PM (#14056966)
I believe the issue is in building high performance types that are both secure and that fit in with the rest of js.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by Dylan16807 on Friday April 07, 2017 @03:04AM (#14057727)
JIT can be faster than static compilation.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by goatlover on Thursday April 06, 2017 @11:35PM (#14056905)
Javascript is less than ideal for this, and was never designed with this sort of thing in mind, unlike C/C++.

Plus, web assembly is here.

Re:Blink-dev – Intent to Ship: SharedArrayBuffer by skrebbel on Friday April 07, 2017 @12:47AM (#14057193)
How is web assembly going to help with multithreading?
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by voxic11 on Friday April 07, 2017 @11:13AM (#14060352)
It's one of the primary goals of the project

> Provide low-level buildings blocks for pthreads-style shared memory: shared memory between threads, atomics and futexes (or synchronic).

New atomic memory operators, including loads/stores annotated with their atomic ordering property, will follow the C++11 memory model, similarly to the PNaCl atomic support and the SharedArrayBuffer proposal. Regular loads and stores will be bound by a happens-before relationship to atomic operators in the same thread of execution, which themselves synchronize-with atomics in other threads. Following these rules, regular load/store operators can still be elided, duplicated, and split up. This guarantees that data-race free code executes as if it were sequentially consistent. Even when there are data races, WebAssembly will ensure that the nondeterminism remains limited and local.

Re:Blink-dev – Intent to Ship: SharedArrayBuffer by rtpg on Thursday April 06, 2017 @10:04PM (#14056495)
I think the idea is for these things (much like TypedArray and the like) to be used by "compile-to-JS" languages, rather than to be used directly too often.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by johncolanduoni on Thursday April 06, 2017 @10:57PM (#14056736)
Making them accessible from WASM is also likely to happen in the future, as they're perfect for running truly multithreaded C/C++, Rust, etc. code.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by tonyedgecombe on Friday April 07, 2017 @02:53AM (#14057691)
We certainly don't seem to know when to stop extending software.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by pmalynin on Thursday April 06, 2017 @09:50PM (#14056416)
You mean like Python? I agree.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by franciscop on Thursday April 06, 2017 @09:55PM (#14056446)
Added a tutorial on SharedArrayBuffer with a lot of other low level JS stuff that looks like a total different language.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by tdb7893 on Thursday April 06, 2017 @09:53PM (#14056433)
Has python gotten much more low level recently?
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by icebraining on Friday April 07, 2017 @02:19AM (#14057545)

  import ctypes
  from multiprocessing import Array
  mysharedarray = Array(ctypes.<type>, 100)
That's essentially the same as this proposal.
Re:Blink-dev – Intent to Ship: SharedArrayBuffer by brianwawok on Thursday April 06, 2017 @09:54PM (#14056444)
I would say async is a little bit lower level, but not at the atomic array level.