comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Why should the value for a discriminant be static?
Date: Fri, 11 Feb 2005 01:40:47 GMT
Date: 2005-02-11T01:40:47+00:00	[thread overview]
Message-ID: <z2UOd.5420$UX3.1713@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <420B5D9B.8060400@nowhere.fi>

Niklas Holsti wrote:

> Now then, that's rather harsh. It's certainly legal Ada; if you think
> its philosophically faulty, you are entitled to your opinion and I am
> entitled to disagree; if you think its faulty because it leads to
> practical problems, the problem is just with the requirement for
> static discriminants in aggregates -- which is what this thread is
> about.

Not at all. There's a software engineering principle that one thing 
should serve one purpose, and this violates that: it serves both to 
identify the 2 classes and to provide the specific information for each 
class.

> Which loses the compile-check that the assigned components exist
> and that all existing components are assigned. This is what I
> (and others) want to avoid. Of course it can be an emergency
> solution as in your anecdote.

The compile-time check exists at the point of the call to the function 
in this case, but in the general case that doesn't hold. On the other 
hand, when designed properly, you do get the compile time check.

> The question is one of symmetry: since the language allows static
> subtypes in the declaration of the variant parts of a record type,
> it should symmetrically allow statically subtyped expressions as
> discriminant values in aggregates for such record types.

So, I guess the language must be faulty to allow static subtypes for 
variants.

-- 
Jeff Carter
"I spun around, and there I was, face to face with a
six-year-old kid. Well, I just threw my guns down and
walked away. Little bastard shot me in the ass."
Blazing Saddles
40



  reply	other threads:[~2005-02-11  1:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-09 14:30 Why should the value for a discriminant be static? Jacob Sparre Andersen
2005-02-09 18:34 ` Randy Brukardt
2005-02-09 20:16   ` Niklas Holsti
2005-02-10  0:19     ` Jeffrey Carter
2005-02-10 13:11       ` Niklas Holsti
2005-02-11  1:40         ` Jeffrey Carter [this message]
2005-02-11  7:52           ` Niklas Holsti
2005-02-09 22:22   ` Jacob Sparre Andersen
replies disabled

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