_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
It may or may not simplify working on the VM and may or may not make it
more solid. But what would it improve for the programs written in Erlang
themselves?
Cheers,
> _______________________________________________
> erlang-questions mailing list
> erlang-q...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
Loïc Hoguin
https://ninenines.eu
In an ideal world, nothing. I would hope that the only benefit to
those coding in Erlang is that maintenance would become more of a sure
thing for the OTP maintainers and that, in particular, new feature
implementation and performance improvements would become more obvious
and safer to implement over time. Those benefits would be beneficial
only indirectly.
That said... I really can't imagine such a large, old, well documented,
well explored runtime known to such a large team would be rewritten to
a new language. I can imagine that some of us (probably including some
of the OTP team itself) would enjoy working on a rewrite in Rust that
is an alternative to, but not a replacement for, the current runtime.
Competing runtimes occasionally expose hidden benefits. But a blanket
replacement would be a massive, end-of-Netscape type upheaval. It is
not as though Erlang is implemented in an obfuscated style of C++ that
suffers from fundamental structure and human incompatability issues.
-Craig
On 2017年09月13日 水曜日 00:27:00 Loïc Hoguin wrote:
> Any thoughts on the benefits existing Erlang programs would get from a
> VM implemented in Rust?
>
> It may or may not simplify working on the VM and may or may not make it
> more solid. But what would it improve for the programs written in Erlang
> themselves?
In an ideal world, nothing. I would hope that the only benefit to
those coding in Erlang is that maintenance would become more of a sure
thing for the OTP maintainers and that, in particular, new feature
implementation and performance improvements would become more obvious
and safer to implement over time. Those benefits would be beneficial
only indirectly.
That said... I really can't imagine such a large, old, well documented,
well explored runtime known to such a large team would be rewritten to
a new language. I can imagine that some of us (probably including some
of the OTP team itself) would enjoy working on a rewrite in Rust that
is an alternative to, but not a replacement for, the current runtime.
Competing runtimes occasionally expose hidden benefits. But a blanket
replacement would be a massive, end-of-Netscape type upheaval. It is
not as though Erlang is implemented in an obfuscated style of C++ that
suffers from fundamental structure and human incompatability issues.
But really, the only thing I can think of that affects erlang programs is that it could make is simpler to write nifs that can't crash your whole vm. I don't know how, however.
I feel like cargo could have a similar community building effect as npm has had for nodejs--an explosion of creativity that resulted in a lot of good quality tools for everyone to use. It's conceivable to me that development of a rust/erl VM could move very quickly by leveraging cargo crates
Sent from my iPhone
Hey!
I really like that guy.
Almost a good enough reason on its own. But I'm being selfish. ;-)
-Craig
That is curious. I wonder if these have been deferred for the time being in favor of using C as an extension (as Rust conforms to the C ABI)?
-Craig
Hello,Any consideration for implementing the Erlang VM in Rust?
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
> Personally, I'd just throw some more time after concurrent OCaml, and then write a translator from Erlang to OCaml :PDo you think concurrent OCaml has advantages over Erlang? And if yes, what are they, in your opinion?
As a serious thought, or as satire?
Rust would.
Rewriting something in C++ in the year of our lord of 2017 isn't the smartest move when there are better tools available. Well I guess it's good for job security, but there is Erlang itself for that already.
As for the emulator loop which requires computed gotos to be implemented, it could instead be generated from a higher-level description of the opcodes directly to an LLVM IR module, which would be faster to compile because the CFG would be less silly written by hand. Using LLVM IR is also something the JIT project I don't remember the name wants to do anyway.
As for what would Rust bring us (apart from a massive improvement of the memory safety of the whole VM), Rust allows people to be way more reckless when writing code, and that usually ends up with less runtime safety belts in the system [2].
I started writing a BEAM module loader in Rust (but I work on it only during holidays because I am actually busy at Mozilla working on things 10 years ahead of the rest of the world), and I think I found some issues in BEAM's code already. I will try to cook some BEAM compiled modules that weird out the VM in the near future.
[1]: https://github.com/erlang/otp/pull/643
[2]: http://www.randomhacks.net/2014/09/19/rust-lifetimes-reckless-cxx/
https://hacks.mozilla.org/2017/08/inside-a-super-fast-css-engine-quantum-css-aka-stylo/
That may not be the correct venue to discuss this, of course. :)
The argument about embedded platforms in 100% correct, though. Rust isn't ready yet on that front.
> Le 13 sept. 2017 à 17:11, Heinz N. Gies <he...@licenser.net> a écrit :
>
> For once Rust is in it’s infancy, the whole language still changes, code that works today might not work tomorrow and libraries often depend on nightly builds and new features.
_______________________________________________
It must be a real treat to work with you!
You seem to be working on "a next generation smart home system", so how do you feel about the inevitable breach of security your product will be hit with for not using memory-safe languages? Or are you one of these people who think "only bad programmers write insecure C/C++ code"?
Anyway, you are the one who sounds like an immature 20-somethings here.
- benoit
Linux or good luck is far from true. Rust works just fine and is well supported on Windows, macOS, iOS and Android. All giant platforms, though user not server oriented. Obviously a consequence of the largest Rust user being Mozilla.
Regards,
Sergej
Erlang is several things
1) A programming language
2) A huge set of libraries
3) A large set of tools
The language can be implemented as a byte code emulator (or threaded
word emulator)
+ a load of BIFs (or NIFs)
The emulator bit is easy (apart from the GC and process management) -
the problem is
all the BIFs and NIFs that are not written in Erlang but written in C.
If I was going to re-implement Erlang I'd try to define a subset of
Erlang with which the
entire emulator GC and process management code could be written.
This subset would be such that it could be cross-compiled to C (or
Rust, or anything)
The goal would be to write MORE in Erlang not less - unfortunately the
trend of the
last few years has been to write LESS in Erlang and more in C (ie with
NIFS) - this improves
performance but makes reimplementation far more difficult.
The path we took in the early 1990's was to make erlang more
performant at the expense of portability. So we moved from a byte
coded machine (JAM) to a threaded word interpretor
(BEAM) - the machine got bigger not smaller.
What we never tried was moving in the opposite direction of making the
machine smaller
and more portable - I'm thinking an ANSI C interpreter and huffman
encoded instructions.
In the 1990's this would have been far slower than the JAM - but today
we're talking GHz
whereas it was MHz in the 1990's.
It would be great tor re-engineer Erlang, and to take the opportunity
to make it more
portable and smaller.
If we had in mind the goals "very small", "very portable", "as much as
possible in erlang, as little as is necessary in C/rust" we might end
up with a nice machine.
I think the gains would come from a careful re-design of the VM not
changing the machine in which the VM is implemented. I believe the Lua
VM has 37 instructions and a small emulator.
The trick is having a VM with correct instructions for implementing Erlang .
The JVM and .NET have the wrong instructions - the JAM and BEAM have
(or had) single
instructions for spawning processes and sending messages - I guess
these could be
augmented with Opcodes for micro GCs and process management.
I'm not convinced that a better programming language to implement the VM helps -
the tricky bit is getting the VM machine instructions correct - at
this level of abstration
the VM is just moving memory around comparing things and jumping
around - which is pretty
easy inn *any* programming language.
In my opinion the great progenitor of VMs was the Pascal P-code
machine (from which
.NET and JVM derive) - then came the WAM (for Prolog) then we added opcodes for
process spawning and message passing (JAM) and turned this into
threaded code (BEAM) .
What would be an interesting experiment would be re-engineer the VM
turning all the
things essential to Erlang and Elixir into opcodes and make an
emulator for this.
The emulator should (or course) we written in a dialect of Erlang and
cross-compiled to C
(or Rust()
Note: This is how we didn't implement Erlang. I designed and
implemented the original VM and opcodes in Prolog - then Mike William
re-implemented the Prolog emulator in C.
The mistake here was that Prolog has built-in GC and C does not - so
there were no
instructions in the JAM for GC (just an instruction so say when the
stack and heap were in
a safe state for GC to occur)
By all means re-implement Erlang - but make it smaller and more
portable, and forget the NIFs
Cheers
/Joe
--
Anthony Ramine
> Le 16 sept. 2017 à 12:03, Joe Armstrong <erl...@gmail.com> a écrit :
>
> I'm not convinced that a better programming language to implement the VM helps -
> the tricky bit is getting the VM machine instructions correct - at
> this level of abstration
> the VM is just moving memory around comparing things and jumping
> around - which is pretty
> easy inn *any* programming language.
It can be easy to implement, but ensure correctness is another thing.
As A. Ramine said, data races can surge almost from everywhere, and
even silly bugs as use-after-free.
If Rust can eliminate these things, it can be worth a looking, and if
not a full, from-scratch replacement, something more incremental: the
interpreters first, the "operating system" part after, and the
libraries can be changed on demand.
What's your opinion of F#? It seems to be the language
of choice for people who liked Caml but need to take advantage
of multiple cores. I haven't done any benchmarking; I doubt
that it could match OCaml in raw speed.
My "dream" would be an industry-supported parallel MLton :P
I even like it so much I've started hacking on an fsharp to core erlang compiler. (https://github.com/kjnilsson/fez).
How does Alpaca compare to F#/Ocaml? After tasting some Rust and Elm, working in Erlang makes me a bit nervous too. My dream is to see a BEAM ML-like achieve Elixir stature.
On Tue, Sep 19, 2017 at 8:57 AM Karl Nilsson <kjni...@gmail.com> wrote:
On Tue, 19 Sep 2017 at 12:41 Jesper Louis Andersen <jesper.louis.andersen@gmail.com> wrote:On Wed, Sep 13, 2017 at 11:38 PM Richard A. O'Keefe <o...@cs.otago.ac.nz> wrote:What's your opinion of F#? It seems to be the language
of choice for people who liked Caml but need to take advantage
of multiple cores. I haven't done any benchmarking; I doubt
that it could match OCaml in raw speed.
I have not used it enough to have an opinion (yet). Were I to communicate a lot with the .NET platform, I'd probably pick it because it has a null value and this is a necessity when talking to C# I'm told.Given that it runs under a pretty powerful JIT, it could perform really well for a lot of tasks I think.F# doesn't typically have any speed advantages of any other .NET languages and in every comparison I've seen to OCaml it has performed worse. If anything the allocation costs induced by a functional first programming style means it is typically a bit slower than the equivalent C# code (also there is no goto).As a language F# is the nicest I've ever used substantially. I find it easy (and fun) to write reasonably correct code in. Also I hardly ever fear refactoring (compared to erlang where I break out in cold sweats even for code bases that pass dialyzer).I even like it so much I've started hacking on an fsharp to core erlang compiler. (https://github.com/kjnilsson/fez).______________________________________________________________________________________________My "dream" would be an industry-supported parallel MLton :P
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
How does Alpaca compare to F#/Ocaml? After tasting some Rust and Elm, working in Erlang makes me a bit nervous too. My dream is to see a BEAM ML-like achieve Elixir stature.
Begging the list's indulgence with tangential and possibly off-topic content.
On Tue, Sep 19, 2017 at 7:57 AM Daniel Goertzen <daniel....@gmail.com> wrote:How does Alpaca compare to F#/Ocaml? After tasting some Rust and Elm, working in Erlang makes me a bit nervous too. My dream is to see a BEAM ML-like achieve Elixir stature.In terms of syntax it's closest to OCaml but it's worth noting we still lack some significant features one would be used to, e.g. ML's module system (and functors, etc) and you'll see hints of Elm in some places like our records. We kept things like adding fields to records, e.g.let record_example () =let r1 = {x="hello", y="world"} in{pi=3.14 | r1}is perfectly legal without declaring those record types in advance.r1: {x: string, y: string}record_example: {pi: float, x: string, y: string}There's a basic tour of the language here if you're further curious: https://github.com/alpaca-lang/alpaca/blob/master/Tour.mdThe pending v0.2.8 release (held up by me being super slow on a couple of bugs I should have fixed months ago) adds some substantial stuff like type annotations and better compiler feedback (both community contributions!)Jeremy
On Tue, Sep 19, 2017 at 8:57 AM Karl Nilsson <kjni...@gmail.com> wrote:
Have you any clue how many oversimplifications this implies?
I get the point you think you are trying to make but srsly, there is this thing called a processor, and IT IS ITS OWN GODDAM LANGUAGE WTF.
Trade one parade of blind-leading-the-blind for another.
-Craig
There's a reason Netscape died...
Perhaps Rust can and should be used for parts of the VM, but a full
rewrite would be suicide, especially considering BEAM development does
not have gigantic resources to begin with.
Even if you rewrite only parts of the VM, while you're rewriting you're
not improving the features stack.
--
Loïc Hoguin
https://ninenines.eu
I think Rust takes several steps in wrong directions, but the answer to (2) is obvious -- even though we've had 40 years to learn how to 'better code our drivers', the world of software is a shaky, broken, rickety pile of insecure nonsense and it's only getting worse over time. There is apparently no amount of learning we can do and we need the machines to help us.Erlang solves the memory safety problem by enforcing immutability, which has incredibly low mechanical sympathy and ends up being unperformant for a large and useful set of problems. Rust solves it by giving the developer a bewilderingly bedazzled straitjacket and telling them to sort it out if they want performance. Pony's straitjacket has better affordances in my opinion but is still deeply confusing to developers. The fact that we are all trying is no accident.
F.F.
On 21 September 2017 at 18:12, Frank Muller <frank.mu...@gmail.com> wrote:Erlang newbie here ... jumping into the subject.While agree with most of the ideas about security, speed ... I still can't get some really basic things.1. Why one should trade a time-proven, close to metal, fars language like C with more than ~40yrs of existence with a new one? We don't even know if Rust will exist in the near future. That's not gonna be the case for C apparently (IoT, etc.).
2. Why simply not simply learn how to better code our NIF/Drivers instead? C was/is my main programming language for many years now, and I didn't have any major issue with it (medium to large projects) in production environment so far. Maybe I'm just lucky, maybe not.
Pids should be planetary wide references with a DHT to find them - processes
should be first class and movable - Protocols should be first class ...
> Le 21 sept. 2017 à 22:37, Joe Armstrong <erl...@gmail.com> a écrit :
>
> I'd like to make an extremely small extremely slow Ertang targeted to
> IOT devices - low power devices with small memory and slow clocks.
_______________________________________________
Oh, its not waiting for anything or anyone...
/(O.o)\
-Craig
I would like to *reduce* the amount of C - write an emulator for language X
in C, then write everything in X. X would be a "better" language than C
in some sense. X should compile to a small instruction set such that
the implementation of the VM would be a simple and hopefully correct program.
if we go back to the P-code machine the design was very simple and the
implementation a few hundred lines of pascal (or C) - I'm pretty sure
one could write a memory safe P-code interpreter in a memory-unsafe
language like C.
Security (since you mentioned it) ultimately relies on trust. Do you trust the
compiler? do you trust the programmers? Do you trust the hardware?
If I were building a secure system I would try to trust as little as possible
putting firewalls and checks between components.
Given a pure choice between a language that offered memory safety
and one that did not I'd obviously choose the memory-safe language
all other things being equal.
Trouble is all other things are not equal.
For me:
Time to solve problem =
Time to understand problem (T1) +
Time to learn language X (T2) +
Time to write program in X (T3)
If I choose C then T2 is very small. Usually T1 >> T3.
The "elephant in the room" is the time to be productive and know the
idioms of programming in X. T3 is small when you are proficient
in the language otherwise large.
I have said before - I think it takes about 3 weeks to learn a language
6-24 months to know your way around the libraries and 10+ years to know
how to solve a problem in your favorite language.
I dabble with new languages, not to become productive in them,
but to see what new ideas they embody.
Niklas Wirth said many years ago that it was far better to be very good at one
language than having superficial knowledge of many.
Cheers
/Joe
Running Erlang directly on the hardware as we do frees the Translation Lookaside Buffers that are used for
virtual memory. These small chips have some which allows very inefficiently to run Unix alike systems.
If we use those VM features to jail in the C code in a NIF it can’t escape its little box.
Therefore we can use Erlang and safe C NIFs on these embedded systems without the overhead
of Unix alike OS, full virtual memory and OS processes.
That eliminates trusting the application level C code. Unikernel and Erlang VM remain though.
Best,
-- Peer
Nowadays we can even forge DNA strands to confuse DNA readers so…
https://twitter.com/bldgblog/status/895728956724322304
> Le 23 sept. 2017 à 09:28, Oliver Korpilla <Oliver....@gmx.de> a écrit :
>
> Having said that I see no immense security risk in writing code for a remote sensor in C. It avoids one of the prime security risks: human user interactions
_______________________________________________
This is, of course, something that can easily devolve into a holy war where everyone clamors for their favorite programming language.
But cannot resist... XD
I never felt empowered by C++ templates. I find that code written heavily depending on templates to drastically decrease in readability (and hence maintainability) while the compile times of C++ are just plain horrible (btw a side effect of how templates were put into the language in the first place). It has been a major pain at my workplace when it comes to running continuous integration.
I learned about a dozen languages well enough to do projects in them, and C++ will always be the ugly one that I want to get away from but which is without alternative in the minds of project managers.
*ducks*
Oliver
Gesendet: Montag, 25. September 2017 um 23:38 Uhr
Von: "Karlo Kuna" <kuna....@gmail.com>
An: "Erlang-Questions Questions" <erlang-q...@erlang.org>
Betreff: Re: [erlang-questions] Erlang VM in Rust
Just to add a voice in this discussion ,
i would love to see c++ implementation of erlang, and it soul be possible due power of templates get much more
safe and easily extendible code base IMHO. It would require lot of expertise and _discipline_ but i cold be fun project
also I wold love to have erlang implementation for IoT, as erlang seems to be great fit for that
for this one i am with Joe, we need something small portable (and written in c++ of course)
On Mon, Sep 25, 2017 at 11:15 PM, Richard A. O'Keefe <o...@cs.otago.ac.nz[mailto:o...@cs.otago.ac.nz]> wrote:
On 25/09/17 10:41 PM, Attila Rajmund Nohl wrote:2017-09-23 9:28 GMT+02:00 Oliver Korpilla <Oliver....@gmx.de[mailto:Oliver....@gmx.de]>:
[...]Having said that I see no immense security risk in writing code for a remote sensor in C. It avoids one of the prime security risks: human user interactions and all the buffer overrun problems and string processing stuff that is so hard to do safely that there are still books being written about.
If it is connected to the internet (the first letter in IoT), then it
at least needs to handle IPv4 - and it involves parsing of potentially
untrusted data.
The remote sensors I am interested in are *not* connected to the
internet. They are connected via radio to each other and to base
stations, and the base stations may then be connected to the
internet (probably using an OS and IP stack written in C).
There is a serious point here that *end* devices are likely to be
as small as you can get away with. Instead of spending money on
bigger/faster machines, it's rather more useful to have *more*
machines that are just capable enough to do the job.
Other people may be interested in other things.
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org[mailto:erlang-q...@erlang.org]
http://erlang.org/mailman/listinfo/erlang-questions_______________________________________________ erlang-questions mailing list erlang-q...@erlang.org http://erlang.org/mailman/listinfo/erlang-questions[http://erlang.org/mailman/listinfo/erlang-questions]
Is it only me who thinks that implementing an actor-oriented functional language in an object-oriented C++ is kind of weird?
GrzegorzJ
This implies C++ has actual objects or encapsulation.
<Drops mic. Runs...>
-Craig
Hi,
A thing to think about is third party non-Erlang.
For example, an awful lot of Erlang projects utilise a C based JSON parser. I don't think anyone does that because they prefer C - it happens because the existing pure Erlang JSON parsers work well and are safer - but hit performance issues at a certain scale.
I'm sure there are similar examples such as database drivers you could refer to. You could remove a lot of C from the average Erlang project by tackling the things that aren't parts of the usual distribution, whether that's "write it in Rust" or, more controversially,
"make Erlang fast enough that pure Erlang JSON is acceptable".