Excerpts from Erik de Castro Lopo's message of 2010-10-14 22:44:03 +0200: > Erik de Castro Lopo wrote: > > > Python and Ruby do have a strict type system, its just that > > the types are checked at run time. In these dynamically typed > > languages, *every* value is an object that caries around with > > it its type. > > > From at least one message in this thread it seems that there > is some confusion about type systems, in particular strict > vs strong typing. > > Type systems can basically be mapped onto two axes; > > strong > | > | > | > dynamic ----------+---------- static > | > | > | > weak > > Strong type systems prevent you from doing things that do not make > sense like adding an integer and a list. For instance, in Python, > > >>> x = 1 > >>> y = [ 1 , 2 ] > >>> x + y > > gives an error like "unsupported operand type(s) for +: 'int' and 'list'". > > Weak type systems allow things that don't make sense (possibly with > a user provided type cast). For instance in C: > > float test (GLIst *list) > { int x = 10 ; > return x + (int) list ; > } > > the above makes no sense whatsoever, but the compiler accepts the > programmers word that this is in fact what the programmer wants. > > Purely static type systems are ones where all the types are checked at > compile time and the run time objects contain no type information > and no type checking is done at run time. > > Purely dyanmic type systems are ones where every run time data > object carries around its type and all the type checking is done > at run time. > > With the above axes set up you can have languages like C with > weak static types, Haskell with strong static types and Python > with strong dynamic types. I don't know of any language that > can really be said to have weak dynamic types. > > Furthermore, most dynamically types languages have a small amount > of static type checking built in, but this is usually a by product > of syntax checking. > > Similarly, in a statically typed langauge its possible to implement > a library with an object type where the type checking for operations > on those objects is carried out at run time. > > Finally, many people assume that all strictly typed languages > require the programmer to explicitly define the types of everything. > Fortunately, this is not the case. There are a whole family of > languages that use Hindley-Milner type inference to infer the types > of all objects from the context. These languages include Ocaml and > Haskell. > > > HTH, > Erik Thanks for this clarification Erik, it's a topic lots of people are confused about, if they have any idea at all. Your explanation with the axis makes sense, thanks. Philipp _______________________________________________ Linux-audio-user mailing list Linux-audio-user@xxxxxxxxxxxxxxxxxxxx http://lists.linuxaudio.org/listinfo/linux-audio-user