POV-Ray : Newsgroups : povray.off-topic : The mysteries of Erlang Server Time
30 Jul 2024 02:23:18 EDT (-0400)
  The mysteries of Erlang (Message 11 to 20 of 29)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 9 Messages >>>
From: Darren New
Subject: Re: Anmesia
Date: 10 Mar 2011 12:59:59
Message: <4d79119f$1@news.povray.org>
Invisible wrote:
> An object/relational hybrid "suitable for telecommunications applications"?

By which they mean reliable, distributed, fairly fast, keeps everything in 
RAM, and expects to run continuously, but which there aren't going to be any 
ad hoc queries.

> It says it has "extremely fast real-time searches", but it also says 
> that the query language is "an add-on library"?

I guess it's extremely fast real-time searches *if* you know exactly what 
you're going to search for. Otherwise, it does a full table lock-and-scan 
without any optimization. And you have to maintain your own indexes, so 
after you insert the record into the table, you have to insert the key into 
each index as well.

The query language isn't the functions used to access the tables. It's sort 
of like saying "We have really fast loops and comparisons. List 
comprehensions are an add-on library."

> Reading the rest of the documentation just made my head hurt. I 
> particularly love how a "table" can be "set", "ordered set" or "bag", 
> but only the first and last option are explained.

That's exactly what I'm saying. You're expected to know that "set" and 
"ordered set" and "bag" are the three different types of ets tables, and go 
read the ets documentation to figure out what that is.

> A reference manual is no way to learn how to use a complex system.

In this case, the other choice is to go work for Ericson, it seems.

-- 
Darren New, San Diego CA, USA (PST)
  "How did he die?"   "He got shot in the hand."
     "That was fatal?"
          "He was holding a live grenade at the time."


Post a reply to this message

From: nemesis
Subject: Re: The mysteries of Erlang
Date: 10 Mar 2011 14:32:55
Message: <4d792767$1@news.povray.org>
the real mistery of Erlang is the name:  at first I thought it was for 
"Ericsson Language".  But then I heard they were actually paying homage 
to one of the pioneers of traffic engineering and related telophony techs:

http://en.wikipedia.org/wiki/Agner_Krarup_Erlang

-- 
a game sig: http://tinyurl.com/d3rxz9


Post a reply to this message

From: Invisible
Subject: Re: The mysteries of Erlang
Date: 11 Mar 2011 03:58:43
Message: <4d79e443$1@news.povray.org>
On 10/03/2011 07:32 PM, nemesis wrote:
> the real mistery of Erlang is the name:

The real mystery of Erlang is that it was *banned* from Ericsson at one 
point...


Post a reply to this message

From: Invisible
Subject: Re: The mysteries of Erlang
Date: 11 Mar 2011 05:10:11
Message: <4d79f503@news.povray.org>
>> Erlang is partially functional, in that functions are apparently
>> first-class, and it's got single-assignment and immutable data
>> structures.
>
> Functions in C are first class. That doesn't mean it's functional.

In C it's not especially easy to write a half-line anonymous function 
and pass that as the argument to something. In fact, function pointers 
are probably the number #1 thing about C that I can't figure out how to 
work, but presumably this only affects me...

> The
> immutable data structures come from the single-assignment, except where
> the data structures aren't immutable, of which there are several.

I wasn't aware that there are any mutable data structures. Then again, I 
read an introductory design document, so...

> Well, that's the killer. To me, if every statement can have
> side-effects, then it's not a functional language.

Depends on your definition of "functional". Some people say that 
first-class functions is the definitive thing. Others claim it's 
referential transparency. A few people even claim it's the type system 
or the syntax...

> You have none of the benefits and all of the
> draw-backs of a functional language in Erlang.

Awesome.

>> The document I
>> read claims that it's considered beneficial to limit side-effects to
>> just a few places in the codebase,
>
> Except that message sending and message receiving are both side-effects
> as is spawning or linking another process, so that works pretty poorly.

The guy goes on to point out that by using gen_server, your code has no 
explicit message passing or process linking at all, and this is an 
extremely awesome thing because it means that your own code is free of 
side-effects.

> Plus, as I said, having the side-effects means you cannot (for example)
> use your own functions in guards.

Oh... my god.

> For some reason, the Erlang enthusiasts think the crappy syntax and the
> single-assignment procedures are intentional and beneficial properties
> of the language. Like any niche language, the fanboi's refuse to accept
> that any compromise was made during its design.

I'm not sure a language with multi-billion lines of code in 
mission-critical production applications can be considered "niche".

> Actually, in the documentation, I think there's a note on each built in
> function that says whether you can use it in a guard or not.

Fail.

>> One data point is scientific fact?
>
> It's a scientific fact that you can achieve nine 9's of uptime over the
> course of a decade with programs written in Erlang, yes. Pretty sure
> that's really, really hard to do with any other programming language.

Do we know that it isn't really, really hard to do in Erlang too? I 
mean, one system did it, but how much time, money and effort did they 
throw at the problem?

Now show that using something other than Erlang would have required 
/more/ time, money and effort, and we have something resembling a proven 
fact. ;-) Now repeat this for more than one system...

>> As I say, this doesn't really seem to be spelled out anywhere else
>> that I could find, and it seems a rather crucial detail.
>
> It's kind of in all the books and stuff. I think the PhD thesis is
> presumed required reading, if nothing else.

"The" PhD thesis?

>> (Quite how you tell the difference between an exception and a normal
>> result is left to the imagination...
>
> Well, an exception will start with EXIT, while a regular result is
> unlikely to, unless you specifically confuse things that way.

It just looks like the sort of thing I might do by mistake, spend 20 
minutes wondering why my application is acting screwy, and then have a 
little facepalm moment.

(E.g., one time I was building a Smalltalk application, and I wanted 
certain building blocks of the application to have names that would 
display on the screen. Obviously the name of a FirstOrderFilter doesn't 
change for each instance, so I added a class method called #name... All 
kinds of fun erupted after that. Eventually I discovered that the Class 
metaclass already /has/ a #name method, or something like that. Ouch!)

>> You mean that if message #5 doesn't arrive, message #6 is actually
>> guaranteed not to arrive?
>
> If message #5 didn't arrive because the receiving machine crashed, yes,
> message #6 isn't going to be received either. If message #5 didn't
> arrive because the network switch died, then #6 isn't going to be
> delivered either.

Presumably if the link dies and then comes back, or any other 
combination of circumstances, either the TCP link is still alive (in 
which case it resents #6 *and* #5), or the link has been broken (in 
which case neither message arrives).

> Yes, exactly. More precisely, you can't tell if the message was received
> and processed or not.

OK.

>> These people are /serious/ about reliability. o_O
>
> Well, yes, that's how you get 5 minutes of downtime over the course of
> 10 years.

Some people might refer to that as "luck". ;-) Apparently there are 
Windows 95 systems with this kind of uptime.

> Well, not quite. If the network between the machines dies, each machine
> is going to think the other crashed. This makes a mess.

"Ow, I don't care *what* universe you're from, that had to hurt!"

>> Thing is, I can open the REPL and type in a function, and then ask to
>> spawn that on a remote node. How does *that* work?!
>
> Hmmm. Actually, I think perhaps it *is* willing to ship functions
> around. The details escape me at the moment. Maybe you can send
> functions but not modules? I don't honestly remember.

Or maybe if you do this, it just tells you to sod off. I don't know...

>> I'll bet. No doubt somebody has written libraries for other languages
>> to speak the same wire protocol.
>
> I don't know. Probably, but I'm not sure why you would.

There are libraries that implement BEEP, even though nobody ever uses 
it. I'm *sure* there are libraries for a massively successful thing like 
Erlang. ;-)

>> I'm not actually sure why though.
>
> Reliability. ;-)

In what way is this more reliable?

>> You would think that a fully interconnected mesh would quickly exhaust
>> the supply of TCP ports too.
>
> Unless you have more than 50,000 machines, unlikely.

Hmm, yes. The number of links rises exponentially, not the number of 
links per node.

> One of the OTP functions shows how to authenticate and encrypt the
> connection en Erlang code, IIRC. That's also one of the tutorials.
>
> Actually, I had forgotten. There is a "cookie" you can set, and anyone
> connecting needs the same "cookie". So there is a minimal security
> level, not unlike the similar feature in X servers.

And the "cookie" is presumably sent unencrypted from node to node when 
they try to connect too.

BTW, how do you identify a remote node? Is it just by DNS name or IP 
address or something?

> What, you're believing fanboi's?

Doesn't everything? ;-)

>>> The two-versions limit is because the code itself isn't GCed. They
>>> document that they could have GCed the code, but that would have added
>>> lots of overhead for something relatively rare.
>>
>> Fair enough.
>
> Plus, you should be dealing with the occasional "process suddenly ends
> for no reason" exception robustly anyway. :-)

Layers within layers of crash recovery... :-}

> I found it annoying that there's no global roadmap. So you read about
> something and it says "If X happens, a message is sent to the error
> logger." WTF is the error logger? Where's the documentation. Then you
> track that down, and it's all talking about bits and pieces that are
> also not documented, etc, with the assumption that you have a bunch of
> people who wrote the error logger hanging around to tell you how to find
> where the errors got logged and such.

An error logger where you can't find the log? Oh, that's epic! :-D

Honestly, I thought only Haskell does this kind of stupidity...

(Yesterday, the new version of the Haskell Platform was released. Which 
is just as well, because the home page has been saying that the next 
release is due in "January 2011" for several months now.)

>> Escaped experiment, eh? ;-)
>
> That's exactly what it was. Except that by the time it escaped, there
> were millions of lines of production code written in it, so you couldn't
> even reasonably fix it.

Well, you can do syntax changes with a conversion program. But 
large-scale language changes? No, not really, no.

>> The advice presumably being that workers should only receive "real"
>> messages, and supervisors should only receive exceptions. Then there
>> can be no ambiguity. (Until the supervisor's supervisor asks it to do
>> something...)
>
> Well, more like, normal worker processes shouldn't communicate with
> messages that start with the atom "EXIT". It's not that hard.

It looks like the sort of mistake I would eventually make, and then 
spend a seriously long time trying to debug. Maybe being all upper-case 
is enough to prevent this, I don't know...

> Hermes gives you as many mailboxes as you want, with as many connections
> to each mailbox as you want, and you can send both connections and
> mailboxes in messages to other processes. So if you want hot-swap code,
> write your processes as being capable of packaging up its mailboxes and
> sending them to a new process.

OK.

>> So you're saying that all the "interesting" stuff like the SSL
>> implementation is actually just an off-the-shelf C library?
>
> It's possible.

What, you mean you don't *know*? Isn't this *documented* somewhere? ;-)

>> I never did understand what's so great about Tk. It looks horrid, it's
>> really hard to use, and it's almost impossible to get the layout you
>> want...
>
> Well, no, it's really easy to use, it's easy to get a good-looking
> layout, and it only looks horrid because it looked cutting-edge 10 years
> ago and nobody ever improved the look of it since then. (Altho they've
> worked on that more lately.)
>
> That's exactly why half a dozen non-Tcl languages actually went so far
> as to embed a Tcl interpreter into their code in order to be able to use
> Tk. I'm pretty sure it's not Tk that's at fault here. ;-)

That's like saying "C is a fantastic language, it's really easy to use, 
and that's why 90% of all software ever written uses it. I don't think C 
is at fault here."

>> Damn. If the actual switching is in hardware, that the heck do you
>> need the CPU for at all?
>
> For deciding what to connect. You pick up the phone? The 6800 connects
> your phone to the dial-tone generator. It's not sitting there generating
> the waveform in software. You push a button? The 6800 routes your line
> to the DTMF decoder, which signals the 6800 each time you let go of the
> tone. When you've dialed enough numbers, the 6800 figures out what line
> you're supposed to connect to and plugs you through.

That's seriously the only reason why it has a Turing-complete processing 
unit inside it?

Man, you would have thought QBASIC would be enough for _that_ level of 
functionality...

> I don't know. Go work for Erricson. ;-)

Worst FAQ answer *ever*! :-D

> It means the compiler is a function in the OTP libraries that you invoke
> in order to compile the code.

FWIW, I wish more languages were implemented like this...

(I'm just bitter because I spent yesterday trying to figure out how to 
get GHC to compile and optimise some source code, and then give me the 
AST. Which I managed, BTW, but trying to figure out WTF the AST actually 
means? Ugh!)

> You can look at the documentation for it to see what it does.

At this point, I don't hold out a lot of hope... o_O

> The other problem is that all the documentation assumes you've read the
> previous documentation and knows what they're talking about, but it
> doesn't actually give you pointers to any of the previous documentation.

I hate that. The Oracle documentation is like this too. Even the 
chapters in a single document refer to things out of sequence. Like, in 
chapter 1, it uses technical terms that aren't explained until chapter 
2, and chapter 2 uses things that were explained in chapter 1, but the 
explanation in chapter 1 doesn't make sense until you read chapter 3 
anyway. WHO WROTE THIS CRAP?!

Still, it could be worse. Consider the following quotation from one of 
the Haskell standard libraries:

http://www.haskell.org/ghc/docs/6.6/html/libraries/mtl/Control-Monad-Writer.html

"Inspired by the paper Functional Programming with Overloading and 
Higher-Order Polymorphism, Mark P Jones (http://www.cse.ogi.edu/~mpj/) 
Advanced School of Functional Programming, 1995."

(Notice that the URL no longer exists.)

I emphasise: /standard libraries/. Not even some exotic add-on library. 
One of the base libraries that comes with the compiler. And there's not 
one single line of human-written text on that page, beyond the reference 
to the paper where this stuff is actually explained.

> You'd like mnesia, tho. It's a lot like STM in some ways.

Except the part where there's at least 3 extensive yet readable 
technical introductions to what it does, why you'd want that, and how 
you use it, with full example source code and explanations. ;-)


Post a reply to this message

From: Darren New
Subject: Re: The mysteries of Erlang
Date: 11 Mar 2011 12:26:30
Message: <4d7a5b46@news.povray.org>
Invisible wrote:
> In C it's not especially easy to write a half-line anonymous function 

I didn't say it was convenient. I said it was first class.

>> immutable data structures come from the single-assignment, except where
>> the data structures aren't immutable, of which there are several.
> 
> I wasn't aware that there are any mutable data structures. Then again, I 
> read an introductory design document, so...

ETS and the process dictionary both spring to mind.

> Depends on your definition of "functional". Some people say that 
> first-class functions is the definitive thing. Others claim it's 
> referential transparency. A few people even claim it's the type system 
> or the syntax...

I can't think of any language nowadays that doesn't have first class 
functions. COBOL and FORTRAN, maybe, but that's about it.

I've never heard "functional" actually mean anything except "what you write 
is functions", as in, mapping inputs to outputs. Anything mutable makes it 
non-functional.

> The guy goes on to point out that by using gen_server, your code has no 
> explicit message passing or process linking at all, and this is an 
> extremely awesome thing because it means that your own code is free of 
> side-effects.

Yes. gen_server separates out the functional part from the non-functional 
part. But that doesn't give Erlang itself any benefits. No doubt functional 
programming is easier to debug. You just have to manually separate it out 
from the rest of the non-functional stuff.

>> Plus, as I said, having the side-effects means you cannot (for example)
>> use your own functions in guards.
> 
> Oh... my god.

Yes, exactly. Still think it's functional?

>> For some reason, the Erlang enthusiasts think the crappy syntax and the
>> single-assignment procedures are intentional and beneficial properties
>> of the language. Like any niche language, the fanboi's refuse to accept
>> that any compromise was made during its design.
> 
> I'm not sure a language with multi-billion lines of code in 
> mission-critical production applications can be considered "niche".

It's niche, as much as formula-1 race cars are niche cars in spite of being 
famous and wildly expensive. ERlang's niche is telecom programs that run for 
decades without crashing.

>> It's a scientific fact that you can achieve nine 9's of uptime over the
>> course of a decade with programs written in Erlang, yes. Pretty sure
>> that's really, really hard to do with any other programming language.
> 
> Do we know that it isn't really, really hard to do in Erlang too? I 
> mean, one system did it, but how much time, money and effort did they 
> throw at the problem?

Well, let's rephrase that. It's certainly easier in Erlang than it would be 
in straight C. :-)

> Now show that using something other than Erlang would have required 
> /more/ time, money and effort, and we have something resembling a proven 
> fact. ;-) Now repeat this for more than one system...

Look up the history of NIL. Then look up the history of Hermes. Now you have 
three similarly-organized systems that all show you can run long-term 
mixed-developer systems reliably by using these techniques.

Do you think Ericson had *not* been trying to come up with this system 
before they wrote millions of lines of code in it? Do you think they 
wouldn't have started using a different system if Erlang didn't give them 
the benefits they expected?

> 
>>> As I say, this doesn't really seem to be spelled out anywhere else
>>> that I could find, and it seems a rather crucial detail.
>>
>> It's kind of in all the books and stuff. I think the PhD thesis is
>> presumed required reading, if nothing else.
> 
> "The" PhD thesis?

Armstrong's PhD thesis.

>>> (Quite how you tell the difference between an exception and a normal
>>> result is left to the imagination...
>>
>> Well, an exception will start with EXIT, while a regular result is
>> unlikely to, unless you specifically confuse things that way.
> 
> It just looks like the sort of thing I might do by mistake, spend 20 
> minutes wondering why my application is acting screwy, and then have a 
> little facepalm moment.

I didn't use Erlang very much, and it never occurred to me to use an atom in 
all upper case, let alone one that says 'EXIT'.

> (E.g., one time I was building a Smalltalk application, and I wanted 
> certain building blocks of the application to have names that would 
> display on the screen. Obviously the name of a FirstOrderFilter doesn't 
> change for each instance, so I added a class method called #name... All 
> kinds of fun erupted after that. Eventually I discovered that the Class 
> metaclass already /has/ a #name method, or something like that. Ouch!)

Name clash of methods? Sure. Name clash of values you're returning against 
the three or four already-defined values? No. Treat it as a reserved word.

This is exactly why so many messages returned start with "ok".

> Presumably if the link dies and then comes back, or any other 
> combination of circumstances, either the TCP link is still alive (in 
> which case it resents #6 *and* #5), or the link has been broken (in 
> which case neither message arrives).

Yes.

> Some people might refer to that as "luck". ;-) Apparently there are 
> Windows 95 systems with this kind of uptime.

No there aren't. All the 16-bit Windows machines had a seconds counter that 
wrapped after 42 days and crashed the computer.

>>> I'll bet. No doubt somebody has written libraries for other languages
>>> to speak the same wire protocol.
>>
>> I don't know. Probably, but I'm not sure why you would.
> 
> There are libraries that implement BEEP, even though nobody ever uses 
> it. 

Actually, I'm rather surprised at the number of people who use 
syslog-reliable (which runs over BEEP) let alone BEEP itself. What makes you 
think nobody uses BEEP?

>>> I'm not actually sure why though.
>> Reliability. ;-)
> In what way is this more reliable?

If you lose a connection to a node, you can ask the other nodes if they lost 
a connection too, for one thing.  And if A connects to B, then B passes a 
connection to C to A, A needs a connection to C anyway. You don't want to 
wait till that point for A to find out it is firewalled from C.

> And the "cookie" is presumably sent unencrypted from node to node when 
> they try to connect too.

No, the cookie doesn't get sent at all.

> BTW, how do you identify a remote node? Is it just by DNS name or IP 
> address or something?

http://www.erlang.org/doc/reference_manual/distributed.html#id80719

The documentation *is* online.

>> Plus, you should be dealing with the occasional "process suddenly ends
>> for no reason" exception robustly anyway. :-)
> 
> Layers within layers of crash recovery... :-}

Incidentally, NIL worked it where you declared which processes were a group, 
and you could kill them off or roll them over as a group. So you didn't have 
the problem of one module being upgraded while another module isn't.

> An error logger where you can't find the log? Oh, that's epic! :-D

I'm sure you can find it if you can figure out which module it talks to. But 
it's like .NET, where debugging output goes to the configured output 
methods, and if you haven't configured them, it disappears. If you're used 
to (say) C's assert() macro, finding out you have to configure where assert 
messages go on a run-by-run basis is rather disconcerting if you didn't even 
think to look.

> It looks like the sort of mistake I would eventually make, and then 
> spend a seriously long time trying to debug. Maybe being all upper-case 
> is enough to prevent this, I don't know...

Why do you make mistakes like that?  How often do you write code and use 
reserved works as variable names?

> What, you mean you don't *know*? Isn't this *documented* somewhere? ;-)

It's in the source code. Welcome to open source!

> That's like saying "C is a fantastic language, it's really easy to use, 
> and that's why 90% of all software ever written uses it. I don't think C 
> is at fault here."

No, because there really wasn't much of an alternative to C for many years. 
People tried many alternatives, and they all sucked so bad they never really 
got out of the lab. So clearly C is doing something right.

> That's seriously the only reason why it has a Turing-complete processing 
> unit inside it?

I don't know what else it does. Billing records, managing the configuration 
changes, etc. The point is it's not switching individual voice packets, any 
more than your CPU is getting involved in deciding which ethernet packets 
going past are addressed to the machine the ethernet card is plugged into.

>> It means the compiler is a function in the OTP libraries that you invoke
>> in order to compile the code.
> 
> FWIW, I wish more languages were implemented like this...

Well, that's the next version of .NET.  I think it's cool. I wish people who 
weren't using Microsoft could use it as easily.

> (I'm just bitter because I spent yesterday trying to figure out how to 
> get GHC to compile and optimise some source code, and then give me the 
> AST. Which I managed, BTW, but trying to figure out WTF the AST actually 
> means? Ugh!)

Erlang can hand you the AST for you to run macro preprocessign on at compile 
time. (That's how records work, for example.) You think figuring out the AST 
when you have a *statically* typed language is hard?

> Except the part where there's at least 3 extensive yet readable 
> technical introductions to what it does, why you'd want that, and how 
> you use it, with full example source code and explanations. ;-)

http://www.erlang.org/doc/apps/mnesia/users_guide.html

Were you maybe reading the reference manual instead of the user's guide?

-- 
Darren New, San Diego CA, USA (PST)
  "How did he die?"   "He got shot in the hand."
     "That was fatal?"
          "He was holding a live grenade at the time."


Post a reply to this message

From: Warp
Subject: Re: The mysteries of Erlang
Date: 11 Mar 2011 12:53:03
Message: <4d7a617f@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> - There are many functional programming languages. (Haskell, OCaml, 
> Clean, and for some reason people keep calling Lisp "functional" too.) 

  Why did you not mention Lisp? It's the first, and still considered by
many to be *The* functional language.

> However, Erlang is *the only* one that could be considered "commercially 
> successful", as far as I can tell.

  How about Lisp?

> Suffice it to say, from what little I could discover, I didn't like what 
> I was seeing. Like most commercially successful languages, Erlang is 
> obtuse, complex, ugly and kludgy. Much like C, Java or anything else 
> wildly popular.

  Can you name a programming language that isn't? (Besides Lisp.)

  And don't say "Haskell". I can understand a Java program much more
easily than a Haskell one. So much for obtuse, complex and ugly.

-- 
                                                          - Warp


Post a reply to this message

From: Orchid XP v8
Subject: Re: The mysteries of Erlang
Date: 12 Mar 2011 08:14:03
Message: <4d7b719b$1@news.povray.org>
On 11/03/2011 05:53 PM, Warp wrote:
> Invisible<voi### [at] devnull>  wrote:
>> - There are many functional programming languages. (Haskell, OCaml,
>> Clean, and for some reason people keep calling Lisp "functional" too.)
>
>    Why did you not mention Lisp?

Ummm... I *did*? It's right there in the quote.

> It's the first, and still considered by
> many to be *The* functional language.

I can't figure out why. Functions are first-class in Lisp, but beyond 
that there's nothing functional about it. (Unless you think "it uses 
lists" has something to do with being functional...)

>> However, Erlang is *the only* one that could be considered "commercially
>> successful", as far as I can tell.
>
>    How about Lisp?

I wasn't aware that there are any multi-million line mission-critical 
production-grade systems written in Lisp. I suppose there might be 
somewhere. I'm certainly not aware of any well-known commercial entities 
telling everybody that they should use Lisp.

>> Suffice it to say, from what little I could discover, I didn't like what
>> I was seeing. Like most commercially successful languages, Erlang is
>> obtuse, complex, ugly and kludgy. Much like C, Java or anything else
>> wildly popular.
>
>    Can you name a programming language that isn't? (Besides Lisp.)

No, I'd say Lisp is kludgy too.

>    And don't say "Haskell". I can understand a Java program much more
> easily than a Haskell one. So much for obtuse, complex and ugly.

There are people who describe mathematical equations as being obtuse, 
complex and ugly. And there are others who describe them as being 
sublimely beautiful, even transcendental. Wanna guess which side I'm on?

Beauty is of course in the eye of the beholder, so I won't argue about 
this further.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Orchid XP v8
Subject: Re: The mysteries of Erlang
Date: 12 Mar 2011 08:40:14
Message: <4d7b77be$1@news.povray.org>
>> Depends on your definition of "functional". Some people say that
>> first-class functions is the definitive thing. Others claim it's
>> referential transparency. A few people even claim it's the type system
>> or the syntax...
>
> I can't think of any language nowadays that doesn't have first class
> functions. COBOL and FORTRAN, maybe, but that's about it.

Java? Eiffel?

> Yes. gen_server separates out the functional part from the
> non-functional part. But that doesn't give Erlang itself any benefits.
> No doubt functional programming is easier to debug. You just have to
> manually separate it out from the rest of the non-functional stuff.

Indeed. It lets you write in a functional style, but doesn't force you 
to. I suppose some people will claim that's "pragmatic".

>> Oh... my god.
>
> Yes, exactly. Still think it's functional?

Personally, no...

>> I'm not sure a language with multi-billion lines of code in
>> mission-critical production applications can be considered "niche".
>
> It's niche, as much as formula-1 race cars are niche cars in spite of
> being famous and wildly expensive. ERlang's niche is telecom programs
> that run for decades without crashing.

Sure. But people often reverse the word "niche" as a kind of polite way 
of saying "hopelessly unsuccessful". ;-)

>>> It's a scientific fact that you can achieve nine 9's of uptime over the
>>> course of a decade with programs written in Erlang, yes. Pretty sure
>>> that's really, really hard to do with any other programming language.
>>
>> Do we know that it isn't really, really hard to do in Erlang too?
>
> Well, let's rephrase that. It's certainly easier in Erlang than it would
> be in straight C. :-)

People claim that Unix (or maybe specificaly Linux) is insanely 
reliable, and that's almost all pure C.

> Do you think Ericson had *not* been trying to come up with this system
> before they wrote millions of lines of code in it? Do you think they
> wouldn't have started using a different system if Erlang didn't give
> them the benefits they expected?

I'm sure Ericsson things that Erlang is great. That's not "scientific" 
necessarily though. ;-) I'm not seriously disagreeing with you, just the 
fanboys.

>> "The" PhD thesis?
>
> Armstrong's PhD thesis.

I wonder if that's the document I just read, or a different one...

>> It just looks like the sort of thing I might do by mistake, spend 20
>> minutes wondering why my application is acting screwy, and then have a
>> little facepalm moment.
>
> I didn't use Erlang very much, and it never occurred to me to use an
> atom in all upper case, let alone one that says 'EXIT'.

> This is exactly why so many messages returned start with "ok".

So many, BUT NOT ALL. It seems to vary inconsistently. Sometimes there's 
an atom to tell you whether it was OK or not, and sometimes there's only 
an atom to tell you when it failed.

>> Some people might refer to that as "luck". ;-) Apparently there are
>> Windows 95 systems with this kind of uptime.
>
> No there aren't. All the 16-bit Windows machines had a seconds counter
> that wrapped after 42 days and crashed the computer.

Got a reference for that?

>>>> I'm not actually sure why though.
>>> Reliability. ;-)
>> In what way is this more reliable?
>
> If you lose a connection to a node, you can ask the other nodes if they
> lost a connection too, for one thing.

Oh, I see.

> And if A connects to B, then B
> passes a connection to C to A, A needs a connection to C anyway.

What makes you think that?

>> And the "cookie" is presumably sent unencrypted from node to node when
>> they try to connect too.
>
> No, the cookie doesn't get sent at all.

So how do you compare it then?

>> BTW, how do you identify a remote node? Is it just by DNS name or IP
>> address or something?
>
> http://www.erlang.org/doc/reference_manual/distributed.html#id80719
>
> The documentation *is* online.

Right. So it's DNS name, plus a user-defined atom (presumably so you can 
run several nodes on a single machine).

>> It looks like the sort of mistake I would eventually make, and then
>> spend a seriously long time trying to debug. Maybe being all
>> upper-case is enough to prevent this, I don't know...
>
> Why do you make mistakes like that? How often do you write code and use
> reserved works as variable names?

More often than you'd think. For example, I might try to use "if" for 
"input file" and "of" for "output file". Shame both of those are 
reserved words in Haskell. But - fortunately - this causes a 
compile-time error in Haskell. You say "treat special atoms as reserved 
words", but if they really were reserved words, you'd get a compile-time 
error informing you of your mistake, rather than mysterious run-time 
behaviour which possibly only shows up under unusual conditions.

>> What, you mean you don't *know*? Isn't this *documented* somewhere? ;-)
>
> It's in the source code. Welcome to open source!

EPIC FAILURE. >_<

>> That's like saying "C is a fantastic language, it's really easy to
>> use, and that's why 90% of all software ever written uses it. I don't
>> think C is at fault here."
>
> No, because there really wasn't much of an alternative to C for many
> years. People tried many alternatives, and they all sucked so bad they
> never really got out of the lab. So clearly C is doing something right.

That's the actual reason? I've often wondered about this, but it was a 
long time ago when all this stuff presumably happened...

>> That's seriously the only reason why it has a Turing-complete
>> processing unit inside it?
>
> I don't know what else it does. Billing records, managing the
> configuration changes, etc. The point is it's not switching individual
> voice packets, any more than your CPU is getting involved in deciding
> which ethernet packets going past are addressed to the machine the
> ethernet card is plugged into.

Wait - the CPU on my PC *doesn't* process the incomming packets??

> Erlang can hand you the AST for you to run macro preprocessign on at
> compile time. (That's how records work, for example.) You think figuring
> out the AST when you have a *statically* typed language is hard?

Strictly, what I'm looking at isn't the parse tree of the Haskell source 
code. I'm looking at the internal data structures used by the Haskell 
optimiser. And it's not so much that the data is complex, it's that most 
of it is complex, and it's difficult to guess where the hell the 
function for examining it is defined. And the API just plain isn't very 
documented. I get the impression that the inside of the compiler is just 
very complex, and not especially tidy, which is surprising.

> http://www.erlang.org/doc/apps/mnesia/users_guide.html
>
> Were you maybe reading the reference manual instead of the user's guide?

Yeah, possibly.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Darren New
Subject: Re: The mysteries of Erlang
Date: 12 Mar 2011 11:55:34
Message: <4d7ba586$1@news.povray.org>
Orchid XP v8 wrote:
>>> Depends on your definition of "functional". Some people say that
>>> first-class functions is the definitive thing. Others claim it's
>>> referential transparency. A few people even claim it's the type system
>>> or the syntax...
>>
>> I can't think of any language nowadays that doesn't have first class
>> functions. COBOL and FORTRAN, maybe, but that's about it.
> 
> Java? Eiffel?

Well, alright. You have to wrap them up in an anonymous class.

> Sure. But people often reverse the word "niche" as a kind of polite way 
> of saying "hopelessly unsuccessful". ;-)

I can't help people don't know english. :-)

> People claim that Unix (or maybe specificaly Linux) is insanely 
> reliable, and that's almost all pure C.

I've never heard anyone claim that.  I've heard Linux people bash Windows, 
and I've heard people brag about how reliable Linux is, but it's certainly 
not reliable enough that it'll run ten years worth of upgrades without a 
reboot or loss of service, unless you go to something like a Tandem.

> So many, BUT NOT ALL. It seems to vary inconsistently. Sometimes there's 
> an atom to tell you whether it was OK or not, and sometimes there's only 
> an atom to tell you when it failed.

In practice, in those routines (like catch) that return the value or an atom 
if it failed, people return an atom tagging the success as well. Or they 
return a different type like a list.

>>> Some people might refer to that as "luck". ;-) Apparently there are
>>> Windows 95 systems with this kind of uptime.
>>
>> No there aren't. All the 16-bit Windows machines had a seconds counter
>> that wrapped after 42 days and crashed the computer.
> 
> Got a reference for that?

I'm sorry your computer can't get through to Google. I hope your 
connectivity gets restored soon.

http://news.cnet.com/2100-1040-222391.html

>> And if A connects to B, then B
>> passes a connection to C to A, A needs a connection to C anyway.

 > What makes you think that?

Because B may pass to A a connection to a mailbox on C.

>>> And the "cookie" is presumably sent unencrypted from node to node when
>>> they try to connect too.
>>
>> No, the cookie doesn't get sent at all.
> 
> So how do you compare it then?

Oh, I see what you're asking. I assume they're smart enough not to send 
passwords in the clear to machines that haven't proven they already know the 
password.

>> Why do you make mistakes like that? How often do you write code and use
>> reserved works as variable names?
> 
> More often than you'd think. 

Wow.

>> No, because there really wasn't much of an alternative to C for many
>> years. People tried many alternatives, and they all sucked so bad they
>> never really got out of the lab. So clearly C is doing something right.
> 
> That's the actual reason? I've often wondered about this, but it was a 
> long time ago when all this stuff presumably happened...

C was designed to be a portable that was *not* abstracted from the machine. 
Therefore, it got ported a lot, often as the first HLL ported to a new 
architecture.  The other languages only got ported to architectures being 
used for that particular type of computing.

When people tried to make better languages than C, they tended to pile so 
much extra stuff into it that would make it appropriate for both 
machine-level stuff and high-level applications that it turned into a monster.

> Wait - the CPU on my PC *doesn't* process the incomming packets??

Not packets not destined for your machine, no. WTF do you think a MAC 
address is for?

-- 
Darren New, San Diego CA, USA (PST)
  "How did he die?"   "He got shot in the hand."
     "That was fatal?"
          "He was holding a live grenade at the time."


Post a reply to this message

From: Darren New
Subject: Re: The mysteries of Erlang
Date: 12 Mar 2011 11:58:55
Message: <4d7ba64f@news.povray.org>
Orchid XP v8 wrote:
> I can't figure out why. Functions are first-class in Lisp, but beyond 
> that there's nothing functional about it. 

Early versions of LISP were functional. It was for a long time the *only* 
popular language you could write anything that looked like functional code in.

Which is the functional language: FORTRAN, C, COBOL, or LISP?

> I wasn't aware that there are any multi-million line mission-critical 
> production-grade systems written in Lisp. I suppose there might be 
> somewhere. I'm certainly not aware of any well-known commercial entities 
> telling everybody that they should use Lisp.

Yahoo was originally all in LISP before it got sold, including the store. 
Several large video games are written in LISP. I think the right answer is 
that more people use LISP than you think, but they don't advertise it 
because it's a competitive advantage.

-- 
Darren New, San Diego CA, USA (PST)
  "How did he die?"   "He got shot in the hand."
     "That was fatal?"
          "He was holding a live grenade at the time."


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 9 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.