comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: argument of conversion cannot be an allocator
Date: 1997/05/16
Date: 1997-05-16T00:00:00+00:00	[thread overview]
Message-ID: <dewar.863787343@merv> (raw)
In-Reply-To: 5lganc$gjp$1@goanna.cs.rmit.edu.au


Dale asks

<<Ah, so are you saying the the type conversion (a_ptr) only "looks at"
the "new", and can't deduce (or doesn't have to) the resultant type from
the "new b"?>>

Not quite, obviously you cannot tell the type of "new x
" by looking at it in isolation (it could be any of a number of different
access types). So you can only use "new x" in contexts where you can figure
out the required type using normal overloading rules, in a way that gives
a unique answer.

But in a type conversion, you only know what type you are going TO, not
what you are coming from, so the type you are coming from must be
uniquely determined by the expression being converted.

I often find that people get type conversions and type qualiffication
badly mixed up, and use the former when they want the latter. I think
that is what happened to you in this case. 

For example, suppose we have two functions

   function f return integer;
   function f return real;

then

    integer(f)

is clearly illegal, since it is ambiguous, but
integer'(f) is fine, and is the proper way of making sure you
get the version of f you want.

type conversions of pointers are unusual
type qualifications of allocators are often required





  reply	other threads:[~1997-05-16  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-14  0:00 argument of conversion cannot be an allocator Dale Stanbrough
1997-05-14  0:00 ` Peter Hermann
1997-05-16  0:00 ` Dale Stanbrough
1997-05-16  0:00   ` Robert Dewar [this message]
1997-05-17  0:00 ` John G. Volan
replies disabled

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