comp.lang.ada
 help / color / mirror / Atom feed
From: <adaworks@sbcglobal.net>
Subject: Re: Type declarations problematic?
Date: Thu, 04 Jan 2007 06:30:16 GMT
Date: 2007-01-04T06:30:16+00:00	[thread overview]
Message-ID: <Y91nh.56478$qO4.54413@newssvr13.news.prodigy.net> (raw)
In-Reply-To: ek69qv$oo0$1@cernne03.cern.ch


"Maciej Sobczak" <no.spam@no.spam.com> wrote in message 
news:ek69qv$oo0$1@cernne03.cern.ch...
> Hi,
>
> http://www.joelonsoftware.com/items/2006/10/12.html
>
> "[it] seems to be that it's explicit typing, where the programmer is asked to 
> declare the type of things, that leads to most of the problems.
>
> [...] it's starting to look like type declarations are one of those accidental 
> difficulties that good programming languages can eliminate."
>
>
> It is obvious that there is a place for dynamically typed languages, but the 
> above statements seem to be a bit too far-fetched. Do they mean that 
> "typeless" languages will just suck some of the Java audience (fine for me), 
> or is it maybe a more general problem that will drive the evolution of 
> programming languages further away from strongly typed systems?
> Do you plan a switch to Ruby? ;-)
>
A class is a type.   It is a very special kind of type, but still a type.
Ruby, and other object-oriented languages do use classes.   Just
as we create instances of types, so too do we create instances
of classes.

Ruby, Python, and a lot of functional languages use reference
implementations of primitive types as well as for classes.  Java
uses by value semantics for primitive types, and class objects
are implemented by reference.

Types are in place whether evaluated dynamically or statically. Perhaps
the question is better asked in terms of static typing.   Also, one needs
to understand what is required of the problem space.  Does safety
make a difference?  Is it useful to use a type-safe language?  How
type-safe do we need to be.  C++ and Java are moderately type-safe,
but with lots of little surprises for the newbie or naive programmer.

Does the fact that a language is by-default type-safe (e.g., Ada) make
it difficult to relax the default?  No.  Ada has a lot of mechanisms
for relaxing type-safety.   It is difficult to take a language where the
default is unsafe and make it safer.   We have a continuum of typing,
well supported by Ada.   Not as well supported by a lot of other
languages.

Assertions are a part of the type system.  Invariants are part of
the type system.   An invariant defines the legal set of states for
instances of a primitive type, abstract data type, or class.

A type:

       1)   has a name (explicit or implicit)
       2)   a set of legal states (values)
       3)   a set of legal operations
       4    a set of rules (language defined) with regard
             to relationships with instances of other types

The fact that an entity is not given a type name does not mean
it is not typed.   Also, the four properties just described are
general enough that lots of instances of things can be included,
even things that seem to have no type at all.

Richard Riehle 





      parent reply	other threads:[~2007-01-04  6:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-24  8:17 Type declarations problematic? Maciej Sobczak
2006-11-24  8:52 ` Dmitry A. Kazakov
2006-11-24 14:41 ` Robert A Duff
2007-01-04  6:30 ` adaworks [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox