Re: How come Ada isn't more popular?
- From: Markus E Leypold <development-2006-8ecbb5cc8aREMOVETHIS@xxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 28 Jan 2007 16:06:48 +0100
"Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx> writes:
On Sun, 28 Jan 2007 00:24:27 +0100, Markus E Leypold wrote:
Charles D Hixson <charleshixsn@xxxxxxxxxxxxx> writes:
It's easier to do simple things in Fortran, C, Pascal, Modula II, PL/I
or even Snobol. Oh, yes, and BASIC, too. (The other current
It's easier to do simple things with languages that have lists in
them. E.g. Lisp or Scheme (or Python for today programmers). No, I
disagree: It's not even easy to do simple things in C: Every time I'm
astounded by the contortions I've to go through for anything involving
strings of varying length (OK, I can work in large statically
allocated buffer, but this simply stinks, since it imposes arbitrary
limits). And very soon the wish comes up not to have to write out
specialized list processing code every time for 'list of ints', 'list
of floats', 'list of strings', 'list of lists of strings', 'list of
trees' etc -- and than you start to suffer and it never ends. There is
no way to write generics in C, to fake them or even graft them onto
the language as an afterthought and use a precompiler or a
preprocessor (I'm perhaps exaggerating here, but the pain is there
nonetheless. I've written those things (a generics "expander" for C
:-) and I think/hope I know about what I'm talking here).
Generics is a wrong answer and always was. As well as built-in lists you
are praising is, because what about trees of strings, trees of lists etc.
You cannot build every and each type of containers in.
You missed my point. :-). A language with a Hinldey-Milner type system
has a 'tree of something' type where something can be anything in
every given instance of usage.
So you get 'tree of foo' from it and 'tree of bar' when you use it
like this, but there are no generics instantiated. There are trade
offs, of course (like that you probably can't design such a language
without GC and without loosing a certain degree of control of the
representation of types), but since C D Hixson and me have been
talking about usefuleness in a general sense, that doesn't count
here. A useful language needs to have lists, you must be able to write
recursive functions on lists and preferably in a functional way and
you should not need explicit instantiation declaration for every
instance (like 'of float', 'of int', 'of ...').
Languages of the Algol-FORTRAN-C-Pascal-Ada group are all far from
that ideal. Since a lot of programming these days is general list
manipulation, everyday jobs become painful.
Has anybody here aver wondered about the popularity of "scripting",
like with Perl, PHP, Python and so on? As I see it, the presence of
lists and hashtables/dictionaries in those languages together with the
absence of memory management is a factor in this popularity. Which I
hope, if not proves, at least makes my point plausible. :-).
Right answers should be a more powerful type system than Ada presently has.
Yes.
In my view there are three great innovations Ada made, which weren't
explored at full:
1. Constrained subtypes (discriminants)
2. Implementation inheritance without values (type N is new T;)
3. Typed classes (T /= T'Class)
Here 2 things are missing:
- parameterized types (see Java generics and the ML type system, the
first is just borrowing from the latter).
- Separation of implementation and type or to put it differently
inheritance and subtyping compatibility. See the ocaml type system.
I admit the contracts are weaker for allowing to instante a
generic with a package with the "right type signature" as
parameter instead of requiring an instance of another specific
generic.
But what is absolutely annoying, is, that the compatibility of
objects is determined by inheritance instead by the type
signature. This makes things like the factory pattern necessary
and it really doesn't work in general case. (And yes, Java and C++
share this defect).
I suggest that anyone trying to improve on the type system of
languages of the Algol family first should aquire a knowledge of the
Hindley-Milner type system, then read the part about objects and
classes in the OCAML manual (this is an extension of Hindley-Milner)
http://caml.inria.fr/pub/docs/manual-ocaml/manual005.html
and finally reads the tutorial on Java generics (introduced in 1.5):
http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf
To me those three together were an eye opener. The Java generics
tutorial in I my eyes documents 2 things: (a) what has been really
sorely missing from Java for 10 years and (b) that you can complement
a type safe pascalish type system usefully with subtyping and
parameterized types.
P.S. All strings have fixed length. It is just so that you might not know
the length at some point... (:-))
Ah, well, thats splitting hairs. We are talking about 2 different
lengths (of strings in C) here: The one is the allocated storage, the
other the distance from the start to the first occurrence of the '\0'
delimiter. Since strlen() returns the latter ...
The problem I've been talking above, is of course to manage growing
strings that might outgrow the allocated storage.
Regards -- Markus
.
- Follow-Ups:
- Re: How come Ada isn't more popular?
- From: Georg Bauhaus
- Re: How come Ada isn't more popular?
- From: Dmitry A. Kazakov
- Re: How come Ada isn't more popular?
- References:
- How come Ada isn't more popular?
- From: artifact . one
- Re: How come Ada isn't more popular?
- From: adaworks
- Re: How come Ada isn't more popular?
- From: Ali Bendriss
- Re: How come Ada isn't more popular?
- From: Charles D Hixson
- Re: How come Ada isn't more popular?
- From: Markus E Leypold
- Re: How come Ada isn't more popular?
- From: Charles D Hixson
- Re: How come Ada isn't more popular?
- From: Markus E Leypold
- Re: How come Ada isn't more popular?
- From: Dmitry A. Kazakov
- How come Ada isn't more popular?
- Prev by Date: Re: Structured exception information
- Next by Date: Re: How come Ada isn't more popular?
- Previous by thread: Re: How come Ada isn't more popular?
- Next by thread: Re: How come Ada isn't more popular?
- Index(es):
Relevant Pages
|