[erlang-questions] Extensions to comprehensions eeps
Richard A. O'Keefe
Fri Aug 1 02:09:42 CEST 2008
On 31 Jul 2008, at 9:47 pm, Anthony Shipman wrote:
> People claim that an advantage of dynamic languages is that you
> don't have to
> put type annotations on variables. The language operations are, as
> far as
> possible, polymorphic at run time.
In a decent language, not "as far as POSSIBLE",
but "as far as USEFUL/REASONABLE".
> So you can change the type of a variable
> and not have to go through the source updating type declarations
> etc. This is
> supposed to make for more rapid prototyping.
> But then you get into the details of Erlang and find that there are
> effectively type annotations all over the place to help the
> compiler. They
> don't appear as explicit type annotations, they sneak in in the
> The existing <- vs <= is just as much an error.
As noted in a recent posting of mine,
there is a fundamental semantic difference between <- and <= .
It doesn't even begin to make anything approaching the shadow
of sense to exchange one for another.
Basically, lists *HAVE* elements, and the pattern in a list
generation plays no part in determining what the elements are.
But binaries do *NOT* have elements. The pattern in a binary
generation *must* be a binary pattern and it is the pattern
which determines how the binary is chopped up. One and the same
binary might result in 20 iterations using one pattern or 50
I have used programming languages that tried to allow every combination
that could possibly be given some twisted sort of sense. I even
designed my own once. I learned the hard way that this is NOT a help
to the programmer.
The things you call "type annotations" and imagine that they are
"to help the compiler" are there to help *people*.
Do you think that having <integer> / <integer> do div (as in C and
Fortran) would be *good* for programmers?
> I would like further
> development in Erlang to fix these errors rather than add many more
> symbols. Otherwise the language would end up looking like haskell.
Nobody is talking about "many more funny symbols".
In fact, the thing that seems to have got up the noses of a couple of
people appears to be the fact that I chose to use combinations of
existing symbols *instead* of inventing a new symbol.
Be specific about what are the "errors" you are complaining of.
I note that Sun recently donated a fancy machine to the Haskell
community because Haskell is particularly good at both concurrency
and parallelism these days, and Sun want that on _their_ multicore
hardware, thank you!
Oddly enough, Haskell is *better* at letting you associate many
meanings with the same symbol than Erlang is.
More information about the erlang-questions