comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: DECAda/VMS - calling GETJPI
Date: 1996/06/05
Date: 1996-06-05T00:00:00+00:00	[thread overview]
Message-ID: <dewar.834000380@schonberg> (raw)
In-Reply-To: DsJ6vu.Ev6@world.std.com


The basic idea here is that type conversion converts the type, but not
the value, of course floating-point to int already violates this somewhat
as Bob points out, but not quite as dramatically.

Consider the following example:

    type x is mod 10;
    subtype y is x range 0 .. 5;

    vy : y;

    vy := y (-4) -- raises constraint error
    vy := y (-6) -- ok, gives result of 4

At the meeting we accumulated a series of odd examples of this kind, and
decided that it is just a bit too weird to have type conversion generating
what amounts to a significant arithmetic computation.

P.S. in my comments in the example above, I am assuming for the moment the
old semantics. In current Ada 95, BOTH assigments to vy raise constraint
error, since -1 is not in the range 0 .. 5.

Actually to be strict, the constraint error is raised by the conversion
because -1 is not in the set of values for modular type x (0 .. 10).






  reply	other threads:[~1996-06-05  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-03  0:00 DECAda/VMS - calling GETJPI Alan Paterson
1996-06-03  0:00 ` Ken Garlington
1996-06-03  0:00 ` Stuart Palin
1996-06-03  0:00   ` Michael F Brenner
1996-06-03  0:00     ` Robert Dewar
1996-06-04  0:00       ` Ken Garlington
1996-06-06  0:00         ` Robert Dewar
1996-06-04  0:00       ` Michael F Brenner
1996-06-04  0:00         ` Robert Dewar
1996-06-04  0:00           ` Michael F Brenner
1996-06-04  0:00             ` Robert Dewar
1996-06-04  0:00             ` Robert Dewar
1996-06-05  0:00               ` Wraparound on modular conversion (was: DECAda/VMS - calling GETJPI) Tucker Taft
1996-06-05  0:00                 ` Robert Dewar
1996-06-05  0:00               ` DECAda/VMS - calling GETJPI Robert A Duff
1996-06-05  0:00                 ` Robert Dewar [this message]
1996-06-05  0:00               ` Fergus Henderson
1996-06-05  0:00                 ` Robert A Duff
1996-06-05  0:00             ` Adam Beneschan
1996-06-07  0:00               ` Norman H. Cohen
1996-06-11  0:00                 ` Adam Beneschan
1996-06-03  0:00 ` Mats Weber
  -- strict thread matches above, loose matches on Subject: below --
1996-06-06  0:00 George Haddad
1996-06-07  0:00 ` Robert Dewar
replies disabled

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