comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Re: Dynamically tagged expression required
Date: Mon, 12 Dec 2005 10:44:22 +0100
Date: 2005-12-12T10:44:22+01:00	[thread overview]
Message-ID: <dnjgpl$i7b$1@sunnews.cern.ch> (raw)
In-Reply-To: <4718553.l2jsoQ7pK7@linux1.krischik.com>

Martin Krischik wrote:

>>OK, so that explains why it's possible to use Shape'Class as a parameter
>>in subroutine. Every time the subroutine is called, the parameter is
>>*initialized* with the value, and therefore it can be different for each
>>call:
>>
>>procedure Draw(S : Shape'Class);
> 
> You know this procedure won't dispatch?

Yes, I want to dispatch *inside* it. I treat it as a more or less 
equivalent to this in C++:

void draw(Shape const &s);

(by more or less equivalent I mean that I'm likely to use them in the 
same design situations, not that they produce the same machine code, 
even if they do)


>>T : Triangle;
>>R : Rectangle;
>>
>>and later:
>>
>>Draw(T);   -- S initialized with T
>>Draw(R);   -- S initialized with R
>>
>>Right?
> 
> Yes. But it only look like the parameter is initialized. Internally the
> compiler likely to use a pointer to pass the paramer to speed up things.

I don't care. :)
I don't want to call something a "pointer" when it isn't in my program.

 > Remember "in" parameter are also constant.

Yes.

> Once the variable is initialized it becomes constained - you can only
> assigned object of the same constain to them.
> 
> Simpler example:
> 
> declare
>   Text : String := "Hello"; - (A)
> begin
>  Text := "World"  - (B)
>  Text := "World!" - (C)
> end

It makes sense now.
Thank you for all the responses,


-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



  parent reply	other threads:[~2005-12-12  9:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08 13:50 Dynamically tagged expression required Maciej Sobczak
2005-12-08 14:46 ` Georg Bauhaus
2005-12-08 14:52 ` Dmitry A. Kazakov
2005-12-08 19:17 ` Martin Krischik
2005-12-09  9:09   ` Maciej Sobczak
2005-12-09 12:05     ` Jean-Pierre Rosen
2005-12-09 16:41     ` Robert A Duff
2005-12-09 20:18       ` Martin Krischik
2005-12-11  0:43         ` Matthew Heaney
2005-12-11 11:45           ` Martin Krischik
2005-12-11 14:24             ` Matthew Heaney
2005-12-11 15:18               ` Martin Krischik
2005-12-11 18:07             ` Matthew Heaney
2005-12-12 19:16               ` Martin Krischik
2005-12-13 20:43                 ` Georg Bauhaus
2005-12-13 21:00                   ` Georg Bauhaus
2005-12-09 20:41       ` Randy Brukardt
2005-12-09 20:16     ` Martin Krischik
2005-12-11  0:46       ` Matthew Heaney
2005-12-12  9:44       ` Maciej Sobczak [this message]
2005-12-12 19:13         ` Martin Krischik
2005-12-14 10:22           ` Maciej Sobczak
2005-12-15 20:10             ` Martin Krischik
replies disabled

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