News for hackers. Stuff that matters.
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by kbumsik on Saturday December 19, 2020 @08:56AM (#25477411)
FYI, AssemblyScript is a TypeScript variant targeted to WASM. If someone would ask why you want to use another JS to use WASM, it is not a scripting language. AssemblyScript produces WASM binaries with minial runtimes so its WASM binary size is very small, even smaller than C outputs (with Emscripten) most of times.

So if you want to write a low-level WASM code in WebAssembly text format (WAT), it is probably a good idea to use AssemblyScript instead.

Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by remram on Saturday December 19, 2020 @10:37AM (#25478006)
So we're on our way to finish the re-creation of Java, by unifying the JavaScript and foreign code into a single bytecode format.

Honestly I'm all for it, and wouldn't change much since most JavaScript written today goes through compilation anyway (TypeScript and/or Babel). Only executing bytecode and taking out JavaScript parsers/interpreters would simplify browser implementations too. Just... what a roundabout trip it has been.

Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by overgard on Saturday December 19, 2020 @10:42AM (#25478045)
I suppose it is, but Java applets never took off because they were horrible. Half the time they wouldn't work, and when they did they never felt like they were part of a page, and generally felt bloated and slow. Much more like a bad version of Flash than something that felt like part of a page.
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by The_rationalist on Saturday December 19, 2020 @07:41PM (#25482795)
This implementation detail issue could be solved by integrating graalvm in the browser and with the DOM
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by zcw100 on Monday December 21, 2020 @07:13AM (#25494170)
I seem to remember that they eventually fixed the problem with slow startup for applets but it was long after people had stopped using them.

Let’s not forget that when applets were a thing Java was a proprietary, although liberally licensed, from Sun Microsystems and the only JVM available was though them. I don’t even know what the status of it is to this day even though there are far more options than there were then.

I didn’t touch Java for years because it was risky to invest time and energy into a language were the owner, Sun and now Oracle, could just yank it or start charging for the JDK at any time. It only became safe when it was successful enough that it became unlikely that thy would do something like that and there started to be viable alternatives. It’s easy to forget that Java had a huge cloud over its head foe many years.

Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by krapp on Saturday December 19, 2020 @11:15AM (#25478322)
There are plenty of languages other than this AssemblyScript that compile to Webassembly whereas only Java code compiled to Java bytecode. It's no more another Java than another C or Lua or any other language that just happens compiles to a binary or bytecode.
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by kabes on Saturday December 19, 2020 @11:27AM (#25478442)
A lot of languages compile to java bytecode.

https://en.m.wikipedia.org/wiki/List_of_JVM_languages

Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by krapp on Saturday December 19, 2020 @11:49AM (#25478687)
Fair enough. How many of those languages are just considered reinventions of Java?
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by acover on Saturday December 19, 2020 @12:17PM (#25478997)
There's an entire list of existing languages that compile to the jvm. A small sample:

COBOL Common Lisp Haskell JavaScript

Most of the languages are not similar to Java.

Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by lolive on Saturday December 19, 2020 @05:20PM (#25481801)
Scala is definitely NOT Java
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by NeutronStar on Saturday December 19, 2020 @08:02PM (#25482906)
No, but he's arguing that Scala compiles to Java bytecode
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by remram on Wednesday December 23, 2020 @10:38AM (#25518655)
By "Java" I meant the runtime, apologies.
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by simplify on Saturday December 19, 2020 @05:32PM (#25481895)
How lucky the young must be, to not hear of Java nor JRE.
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by rat87 on Saturday December 19, 2020 @10:11PM (#25483512)
There are far more languages that compile to Java bytecode then to javascript or Webassembly and it has been a thing for far longer. The Java virtual machine has a good jit-compiler(at least for java but often for other languages too) and a good garbage collector. It offers access to many useful libraries especially for desktop guis so its long been a target. Most popular languages targeting java include groovy, scala, clojure, Kotlin. Also Jruby is a fairly popular alternative ruby implementation on top of the JVM

You're probably thinking of something like cpythons bytecode which is unstable internal only thing (breaking compatibility with minor python versions). Java bytecode has to be stable since it had to be shared by multiple jvm implementations. And even then a famous ruby hacker made a ruby-to-python-bytecode-compiler(now probably broken by version changes).

https://news.ycombinator.com/item?id=2321204

Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by emteycz on Sunday December 20, 2020 @03:14AM (#25484761)
> There are far more languages that compile to Java bytecode then to javascript or Webassembly

No. There are far more languages that compile to Wasm.

Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by wizzwizz4 on Saturday December 19, 2020 @09:14AM (#25477492)
AssemblyScript is a tiny subset of TypeScript; it's probably better to describe it as a C-like compiled language that borrows syntax from TypeScript.
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by maxgraey on Saturday December 19, 2020 @10:42AM (#25478049)
Not only syntax, but also standard library, ecosystem and etc. You could easily transpile AssemblyScript project to JavaScript via tsc if use portable glue code. From C it I guess it borrows AOT compilation, ability to use low-level intrinsics and more granular and sound types. Btw many people still thought AS has manual memory management, but it's not true. By default it use hybrid ARC and GC approach called PureRC: https://github.com/dcodeIO/purerc/blob/master/papers/Bacon03...
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by wizzwizz4 on Saturday December 19, 2020 @06:09PM (#25482166)
You can easily transpile any C-syntax subset into C, if you use the right libraries. Same with Python, or Java, or MIT Scratch, or any other language I can think of.
Re:AssemblyScript: A variant of TypeScript targeting WebAsse... by appleflaxen on Sunday December 20, 2020 @05:56AM (#25485385)
that description should be on their front page; it communicates the concept more clearly than "A language made for WebAssembly" IMO