News for hackers. Stuff that matters.
Re:Scala Native v0.1 by dillonb on Tuesday March 14, 2017 @11:28AM (#13868271)
Well, this is just targeting a different VM, LLVM instead of the JVM. You get easy interop with all LLVM languages with this, including C.
Re:Scala Native v0.1 by the_duke on Tuesday March 14, 2017 @01:11PM (#13869404)
You should really check your facts before posting a statement like this.

While the VM in LLVM historically was short for Virtual Machine, it really has nothing to do with that. It's a compiler backend used by Clang (C++ compiler) and Rust.

Re:Scala Native v0.1 by Hongxu on Wednesday March 15, 2017 @02:17AM (#13874176)
LLVM IR apparently is not restricted to C/C++/Objc/Swift etc, it is a generally purposed IR; and LLVM itself is an infrastructure that contains many facilities to deal with compilation backends (mostly, analyses and transformations).
Re:Scala Native v0.1 by acjohnson55 on Tuesday March 14, 2017 @01:24PM (#13869536)
My understanding is that IR is designed as though there were a VM to run it, but in practice, IR is immediately used to generate code for a target architecture.
Re:Scala Native v0.1 by dbaupp on Tuesday March 14, 2017 @01:34PM (#13869621)
That might have been true originally, but I don't think anyone uses LLVM like a JVM/CLR-esque VM any more. As the parent states, the original Low-Level Virtual Machine initialism was even retracted, meaning the project's name is just the "arbitrary" sequence of letters LLVM, with no particular meaning assigned to them.
Re:Scala Native v0.1 by steveklabnik on Tuesday March 14, 2017 @11:58AM (#13868615)
LLVM is not a VM in the same sense as the JVM is.
Re:Scala Native v0.1 by dillonb on Tuesday March 14, 2017 @12:03PM (#13868670)
Yup.
Re:Scala Native v0.1 by krona on Tuesday March 14, 2017 @11:43AM (#13868418)
Easy interop with C++ or Rust? I'll believe it when I see it.
Re:Scala Native v0.1 by dillonb on Tuesday March 14, 2017 @11:47AM (#13868478)
It looks like it can!

http://www.scala-native.org/en/latest/user/interop.html

>Scala Native provides an interop layer that makes it easy to interact with foreign native code. This includes C and other languages that can expose APIs via C ABI (e.g. C++, D, Rust etc.)

Re:Scala Native v0.1 by username223 on Tuesday March 14, 2017 @12:17PM (#13868811)
From that page, it looks like Scala-C interop is decent, but that's a far cry from C++/Rust interop. For C++ at least, you more or less need to write a pure-C wrapper API to call from Scala, since it doesn't handle C++ types.
Re:Scala Native v0.1 by dillonb on Tuesday March 14, 2017 @01:08PM (#13869362)
Interesting, I guess I understood that wrong. Looks like no "easy" interop, but it's there if you really need it and don't mind the extra work.

I've been playing with this and trying to convert a ~20 line helper script that I use at work (and would really like to benefit from no JVM warmup time), and I've already run into missing core library functions like parallel collections and regexes.

This thing will be really great when it's ready, but it's not even close yet.

Re:Scala Native v0.1 by steveklabnik on Tuesday March 14, 2017 @12:27PM (#13868911)
You would need the same for Rust as well.
Re:Scala Native v0.1 by spullara on Tuesday March 14, 2017 @06:51PM (#13872233)
Rust's FFI is the same as C.
Re:Scala Native v0.1 by steveklabnik on Tuesday March 14, 2017 @08:50PM (#13872950)
I'm not sure what exactly you mean by that, but what I was trying to say is that you can't expose Rust directly, you need to expose a C ABI. Which is totally doable, but is not just "drop in Rust code and it works."
Re:Scala Native v0.1 by krona on Tuesday March 14, 2017 @12:13PM (#13868764)
> languages that can expose APIs via C ABI

That's what I thought.. another C-based FFI. Better than nothing, I suppose.

Re:Scala Native v0.1 by andreaferretti on Tuesday March 14, 2017 @12:20PM (#13868839)
Nim has pretty decent interop with C++. In general, though, you are right that C is much much easier to interop with