Live data from Hacker News

How I fell in love with Erlang

boragonul.com

171–180 of 263 posts

Re: How I fell in love with Erlang

#171
post #115

Earlier quoted context omitted.

> Why has no one put microkernels and Erlang into a blender? I know there's QNX, but it's still UNIX, not Erlang. That's a very good question. There are some even lesser known dialects out there that do this but you are going to find it hard to get to the same level of feature completeness that Erlang offers out of the box. QNX and Erlang embody quite a few of the same principles, but QNX really tried hard to do this…

> That would be an absolutely awesome project. Usually when you can think of it someone has already done it so a bit of googling I've done a bit of googling and research, nothing viable has surfaces, and I still haven't found the time to create a prototype myself, just some doodling around here and there. I do agree that it's an awesome idea, and it's been stewing in my head for a couple years now! There are a lot of…

I've got a hobby OS you may want to check out. Crazierl is a just enough kernel that can run the FreeBSD build of BEAM as a single OS process.

Features include: x86-32 only, bios boot only, SMP capable, drivers in Erlang (there's nifs for managing memory with devices or i/o; and the kernel manages the interrupt controller(s) and has console output before userspace takes over), a kind of working IPv4 stack, dist!

It doesn't run on all my machines, but it does on some (it does some VGA things that I guess aren't well supported and also non uefi is iffy these days too. I typically run it in qemu and v86, but I think it will work in VMWare as well.

https://crazierl.org/ https://github.com/russor/crazierl/

There's a hosted v86 demo as well (works better on a desktop than a phone):

https://crazierl.org/demo.html

It's also in the weird OS section at https://copy.sh/v86/

Re: How I fell in love with Erlang

#172
post #152

Earlier quoted context omitted.

This blocked me from understanding computer programming for 3 years. I thought of 'variables' as immutable and the fact that they were not didn't really click at all. Once I mentally transitioned from 'it's a label attached to a value' to 'it's a named box which holds a value' life got a lot easier. I was 15 when it finally clicked (on a TI programmable calculator...).

That is fascinating. I guess I got through that when I was 7 on a pass-me-down ZX81 from a relative who just had upgraded to a Spectrum (I assume). I mentally called bull when reading boragonul's story because: a) BASIC has a REPL b) Kids back then had near infinite patience/time. c) These computers came with pretty good manuals explaining BASIC There was very little external stimuli. As an example: TV broadcasters i…

I learned to program in the 8 bit era, initially in BASIC on the TRS 80, then later assembly on the KIM-1 and then the 6809 based Dragon 32 (CoCo clone), which for the first time felt like a real computer. After that the BBC Micro and then the ARM, and eventually PCs.

Those first years were a real slog. I wanted to understand this stuff so much but it just did not click. I actually remember when it did, it was like a lightbulb going on and I went from 'this sucks, I can't hack it' to 'this is my future' overnight.

The I read a book by Niklaus Wirth and it opened my eyes to structured programming and various data structures (beyond variables and arrays). It's funny because even though I've read a mountain of books on computer programming by now that is still the one that gave me the most practical day-to-day knowledge which comes in handy every day.

Re: How I fell in love with Erlang

#173
post #115

Earlier quoted context omitted.

> Why has no one put microkernels and Erlang into a blender? I know there's QNX, but it's still UNIX, not Erlang. That's a very good question. There are some even lesser known dialects out there that do this but you are going to find it hard to get to the same level of feature completeness that Erlang offers out of the box. QNX and Erlang embody quite a few of the same principles, but QNX really tried hard to do this…

> That would be an absolutely awesome project. Usually when you can think of it someone has already done it so a bit of googling I've done a bit of googling and research, nothing viable has surfaces, and I still haven't found the time to create a prototype myself, just some doodling around here and there. I do agree that it's an awesome idea, and it's been stewing in my head for a couple years now! There are a lot of…

> Any reason you haven't posted it on Github/Codeberg?

Yes, I don't want Microsoft to be able to pretend claim I gave it to them for some particular purpose which I didn't. They'll have to come and take it.

Feel free to use that code and do anything you want with it, and if there are no more seeds for the code let me know and I'll serve up the torrent.

Re: How I fell in love with Erlang

#174
post #171
post #115

Earlier quoted context omitted.

> That would be an absolutely awesome project. Usually when you can think of it someone has already done it so a bit of googling I've done a bit of googling and research, nothing viable has surfaces, and I still haven't found the time to create a prototype myself, just some doodling around here and there. I do agree that it's an awesome idea, and it's been stewing in my head for a couple years now! There are a lot of…

I've got a hobby OS you may want to check out. Crazierl is a just enough kernel that can run the FreeBSD build of BEAM as a single OS process. Features include: x86-32 only, bios boot only, SMP capable, drivers in Erlang (there's nifs for managing memory with devices or i/o; and the kernel manages the interrupt controller(s) and has console output before userspace takes over), a kind of working IPv4 stack, dist! It d…

Very neat! I have my own OS to work with that I know like my back pocket, so if I ever go this route I'll probably just carve that up.

Re: How I fell in love with Erlang

#175
post #7

It's funny how HN goes through these Erlang cycles. It's a long standing tradition, starting off with 'Erlang Day': https://news.ycombinator.com/front?day=2009-03-11 Erlang gets a lot of stuff right for scalable web based stuff, and even though there are many of its influences that have by now made it into other languages and eco systems it is still amazing to me that such a well thought out system is run with such i…

Unfortunately, I have to disagree on the absolute notion, that you will never see someone being not nice in the Erlang world. OK, you technically said "behind Erlang", not "in Erlang ecosystem". But in the Erlang ecosystem and related languages I've had at least 2 encounters, that were not nice. One outright called lack of good documentation for some projects in the Erlang ecosystem bullshit in a public chatroom, and…

I meant it the way I wrote it, so that makes this a strawman.

Every group of > 10 people will have at least one jerk in it.

Re: How I fell in love with Erlang

#176
post #22

> X equals X plus one? That’s not math. That’s a lie. That's really interesting... My wife, who has no real mathematical background had the EXACT same reaction when I was trying to teach her some simple programming. I tried to explain that equals in that context was more of a storage operator than a statement that said line is true. She found it very frustrating and we gave up on the endeavor shortly thereafter. I've…

Cuis Smalltalk

    x ← x + 1

Although you'd need to type

    x _ x + 1
and it might copy/paste as

    x := x + 1

Re: How I fell in love with Erlang

#177

> “How can you sum the numbers from 1 to 10 without using a loop?” ... And there it was: recursion. Wait, is there something I don’t actually understand about recursion? When a recursive function calls itself, is that not a loop?

It depends on how technical you want to get. It's certainly not a loop in the classic sense, like a for loop etc. Like there are no `continue` or `break` semantics and you can't return out of it (and yes yes of course you can still do all that stuff, just not with dedicated keywords). I call it a loop, though. Whenever I make a lil' server in Elixir (mostly always for teaching) I always call the function `loop`: defm…

To put it another way: anything you can express with iteration, you can express with recursion (just as long as you don't run out of call stack).

Once you get it, it's obvious, but if you're not already familiar with the notion, the understanding can be pretty amazing.

Re: How I fell in love with Erlang

#178
post #152

Earlier quoted context omitted.

That is fascinating. I guess I got through that when I was 7 on a pass-me-down ZX81 from a relative who just had upgraded to a Spectrum (I assume). I mentally called bull when reading boragonul's story because: a) BASIC has a REPL b) Kids back then had near infinite patience/time. c) These computers came with pretty good manuals explaining BASIC There was very little external stimuli. As an example: TV broadcasters i…

I learned to program in the 8 bit era, initially in BASIC on the TRS 80, then later assembly on the KIM-1 and then the 6809 based Dragon 32 (CoCo clone), which for the first time felt like a real computer. After that the BBC Micro and then the ARM, and eventually PCs. Those first years were a real slog. I wanted to understand this stuff so much but it just did not click. I actually remember when it did, it was like a…

Boy can I confirm that happening to find the right book back then was absolute key. And they were so expensive! Never really bought one.

These days it's almost painful to come across great books that would have been so awesome to have in like 1984.

Re: How I fell in love with Erlang

#179

Calls a simple swap function with pointers inscrutable (the only hard to decipher character is the asterisk), and as a good counterexample provides this ? -module(ping). -export([start/0, ping/1]). start() -> register(ping, spawn(fun() -> ping(0) end)). ping(Count) -> receive {pong, Pong_PID} -> io:format("Ping received pong (~p)~n", [Count]), Pong_PID ! {ping, self()}, ping(Count + 1) end. I am not against functiona…

> ...at least make a valid argument about it ;)

Like other folks have said, show the equivalent C program and then we can have a discussion about implementation complexity and comprehensibility.

Do note that the equivalent C program permits IPC between two instances of the program that could be either running on the same machine or could be running on different machines connected by an IP network.

Edit: For general information, here's an Erlang implementation of increment and swap. Swap is made a bit complicated because Erlang doesn't support multiple returns... returning a tuple or list is the way that's handled, so I had it accept a two-element tuple for consistency with what it returns:

  increment(A) -> A + 1.
  swap({A, B}) -> {B, A}.

Re: How I fell in love with Erlang

#180
post #29
post #7

It's funny how HN goes through these Erlang cycles. It's a long standing tradition, starting off with 'Erlang Day': https://news.ycombinator.com/front?day=2009-03-11 Erlang gets a lot of stuff right for scalable web based stuff, and even though there are many of its influences that have by now made it into other languages and eco systems it is still amazing to me that such a well thought out system is run with such i…

I don't think it's cycles, more like newcomers rediscovering the future. I've learned Elixir in 2016 after a lull in my interest in programming languages, and 9 years later it's still my favourite environment by a country mile. It's not the language per se, but the BEAM, the actor model, the immutability — just makes sense, and doing things the C/Rust/Javascript/Python way is like building bridges out of cardboard. F…

> but there is a sore lack of something closer to the metal within 80% the speed of a native language.

As someone who built an entire startup in elixir, its a good time to bring up that elixir has an excellent interop with rust via rustlr.

Post reply on HN