[erlang-questions] Immutable isn't static Was: Re: Process scope variable
Richard A. O'Keefe
ok@REDACTED
Fri Mar 13 06:25:39 CET 2015
On 13/03/2015, at 11:43 am, Imants Cekusins <imantc@REDACTED> wrote:
> Why some programmers pay much attention to what the others say about programming, how they write their code, try to convince, change their mind?
Because if you *talk* wrong about a program,
you'll *write* it wrong.
>
> Let's say, a program is written by someone. For various reasons, we may choose to use it or not. But isn't the key criteria: does it work for us?
"Criteria" is plural. And no, the question is not "does it work".
Practically no software can be relied on to work. The question is
"can it be fixed". And if the programmer gibbered like a maniac
speaking a private language, the answer is "probably not."
>
> I use so much software of which I have no slightest idea what the code looks like. Yet it works!
It must be nice to live on your planet.
How do I get there?
This week, for example, I had a large (vertices and edges) graph that I wanted
to display. So I turned to a program that I have mostly been able to use in
the past. There are some painful user interface issues, but I can work around
them by killing the program and restarting.
Except that I now have Java 1.8 on my machine, and this program only works in
Java 1.6. So there are sources. The web page explains how to build the
program from sources using NetBeans. No problem. I have NetBeans. It turns
out that they switch from NetBeans projects to Maven. I didn't have Maven.
So I installed Maven. And the attempt to build the program I wanted to use
failed miserably, and I have no idea why. Installing Java 1.6 on the machine
didn't let the program work, as people on the net said it would. Although
Java 1.6 is _there_, the program insists on using Java 1.8 and failing.
THIS HAPPENS TO ME ALL THE TIME.
Just yesterday, I had to pay quite a large bill at a major bank.
One of their computer "systems" WILL accept apostrophes in names
and one of them WON'T.
Why is this *still* a continuing annoyance 50 years after banks here
started using computers?
Today I bought materials for lunch at a nearby supermarket.
I have a debit card with a chip and a stripe.
I inserted the card for the chip and it said to swipe it.
So I swiped the card and the EFTPOS system said to insert it.
So I inserted it and the system said to swipe it.
When it timed out and reset, the machine read the card with no trouble
at all.
This is *COMMONPLACE*.
I'm typing this in "Mail" version 7.3 (1878.6) on a desktop Mac running
OS X version 10.9.5. The "Search" facility is totally non-functional
and has been since I got this version of the software. Nobody here
knows how to fix it. (You can go through the motions of searching,
but there is no known set of conditions under which it will ever find
anything, even the message you are looking at.) I am reduced to running
an antique WebMail system in a web browser (I do not know if
SquirrelMail is its real name or just what people call it) in order to
search *and* Mail in order to have something nearly usable for typing into.
Or take the iPad my department has loaned to me. When I upgraded to
iOS 7, it forgot that it had a loudspeaker. That took some fixing.
A planet where "Yet it works!" was even *close* to true would be a
truly amazing place to visit.
>
> Why would I try to convince someone how to write their code?
Because most code is HORRIBLE.
And most of the remainder is BLOODY HORRIBLE.
Because somehow you are going to end up paying for it to be fixed.
I left industry for academia because I was really sick of commercial
programs that didn't work, and wanted to try to help educate programmers
to do better. The forces working against this are so strong that I'm
not satisfied that I've achieved much.
> I can see this is a popular sport. Yet I must be missing something. What's the thrill?
There is no thrill. There is bitter anguish borne of long experience.
There are people desperately trying to avoid being harmed AGAIN.
>
> Oh yeah, and why are there so many different programming languages? Can there be just one or two?
We (as in the industry as a whole, and individuals who've lived through
enough of it) have tried that. It didn't work.
Lisp was a shining example of the international Lisp community getting
together to define a common dialect. Even the InterLisp people, with
an ugly but extremely *useful* dialect, co-operated, despite it meaning
they had to write a whole new compiler. What was the result of
Common Lisp coming out?
Two rival standards: EULisp and ISLisp.
(Don't bother looking them up; you won't find anything worth using.)
Before that, PL/I was supposed to be the One Ring to rule them all:
it merged COBOL, Algol, and Fortran, with a bit of list manipulation
thrown in. (Although for some reason they thought pointers were
where the type system should completely give up.)
More recently, we saw Ada as the one all-purpose programming
language. There's a lot to like in Ada. It is so clever and
powerful that the only bugs in your program are the ones in the
compiler. (Joke.) Honestly, I like Ada. But it would be an
incredibly bad replacement for the UNIX shell...
Of course there are social factors. Judging from your name, I
suspect that you probably don't speak Maori. Are you interested
in abandoning your native language and switching to Maori?
How about Hindi?
But there are also technical factors.
Amongst other things, programming languages are designed by human
beings, WHO MAKE MISTAKES. People often make mistakes because
THEY TAKE TO THEMSELVES USING SLOPPY TERMINOLOGY.
As a case in point, Coral 66, which is still supported, was a
nice little language in which the designers somehow managed
to tangle up the concepts "has an initial value" and
"is statically allocated" as if they were the same thing.
And they perpetuated the dangling else and the "'while' is
only available as part of a 'for' loop" design botches long
after the Algol community had realised that these were
mistakes. (Well, how can we blame Coral 66's designers for
keeping the dangling else when Java's and JavaScript's
designers perpetuated the same bungle despite decades more
experience that this was stupid? Because people figured out
almost immediately after Algol 60 was published that it was
a blunder, _that's_ how we can blame them.)
But another technical issue is that programming languages serve
different needs. There's a whole area of "domain specific
languages" (going back to the 60s when they were called
"problem oriented languages") based on the idea that a
special-purpose language can make it EASIER to say what you
DO want and HARDER to say what you DON'T want.
I've just finished the first draft implementation of a little
language for generating configuration files in JSON. It's
the first time I've even considered a language that does not
support recursion, but a key point of the design is that any
script in this language MUST terminate. (It also cannot have
any effect on the file system other than updating last-read
timestamps.) I wouldn't tolerate this in a general purpose
language, but for this special purpose, it's just right.
I will admit to fairly serious annoyance that having installed
Ant and Maven on my machine, the next JVM program I was interested
in using turned out to require Leiningen.
A couple of hours ago I was talking to a student who's doing
something cool with an Android tablet -- not Erlang-related,
sorry -- and I told him that he should make sure that anyone
who has an Android SDK for C++ should be able to install and
even build program without anything extra.
More information about the erlang-questions
mailing list