comp.lang.ada
 help / color / mirror / Atom feed
From: Manuel Collado <m.collado@fi.upm.es>
Subject: Re: not X'Length
Date: Fri, 16 May 2008 10:04:23 +0200
Date: 2008-05-16T10:04:23+02:00	[thread overview]
Message-ID: <g0jf8d$71j$1@heraldo.rediris.es> (raw)
In-Reply-To: <717bf87e-b8b6-4129-8051-7bd45cf2f7b2@a9g2000prl.googlegroups.com>

Adam Beneschan escribi�:
> On May 15, 1:48 pm, Georg Bauhaus <see.reply...@maps.futureapps.de>
> wrote:
>> christoph.gr...@eurocopter.com wrote:
>>> From RM 4.4 follows that this is equivalent to

>>> if (not X'Length) in Positive then

>>> Now Universal_Integer (X'Length is of this type) has no operators, so
>>> it has to be converted to an appropriate type. This is Integer (or, to
>>> be very precise, the type of Integer) in this case. But then there is
>>> no "not" defined for this type. So the compiler is correct.

>> While the compilers are correct, on the programmer's part the
>> issue is not that easy to understand in general.
>> You have demonstrated why this is so. Hence my original
>> question about programmer expectations regarding improved
>> compiler's diagnostics in this case.
> 
> You may be right that a better diagnostic would help in this specific
> case.  But a programmer cannot expect a compiler to be a mind-reader.
> And a compiler writer can't really go through every possible weird
> combination of things to figure out what sorts of accidental trouble a
> programmer could get themselves into---there are just too many
> possibilities.  About all a compiler writer can do is respond to
> particular situations when they get noticed.

Perhaps the compiler could state how the expression is parsed, so the 
diagnostic message can be better understood:

    if not X'Length in Positive then
                    |
    >>> incompatible types: parsed as
    >>> if (not X'Length) in Positive then

Just my 2c.
-- 
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado



  reply	other threads:[~2008-05-16  8:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15  9:19 not X'Length Georg Bauhaus
2008-05-15  9:39 ` christoph.grein
2008-05-15 10:12   ` christoph.grein
2008-05-15 20:48   ` Georg Bauhaus
2008-05-15 22:20     ` Adam Beneschan
2008-05-16  8:04       ` Manuel Collado [this message]
2008-05-16  8:15       ` Georg Bauhaus
2008-05-16 12:52     ` Stephen Leake
replies disabled

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