comp.lang.ada
 help / color / mirror / Atom feed
* RE: Ada 0y wish list: "with private"
@ 2001-02-15 19:16 Beard, Frank
  2001-02-15 20:03 ` RE: Ada 0y wish list: Ted Dennison
  0 siblings, 1 reply; 3+ messages in thread
From: Beard, Frank @ 2001-02-15 19:16 UTC (permalink / raw)
  To: 'comp.lang.ada@ada.eu.org'

I disagree.  If the compiler treated the deferred type
as a "by reference" type then there wouldn't be a problem.
It would be similar to an access type without the requirement
of allocation/deallocation, null checks, etc.

When a variable of type B is declared, the compiler will
always pass it by reference (by address), which is the
equivalent of passing an access type.

Frank

-----Original Message-----
From: Christoph Grein [mailto:christoph.grein@eurocopter.de]
Sent: Wednesday, February 14, 2001 11:54 PM
To: comp.lang.ada@ada.eu.org
Subject: RE: Ada 0y wish list: "with private"


   package A is

      type B is private;

   private

   end A;

   package body A is

      type B is ...;

   end A;

There are severe code generation problem with this proposal. When the spec
of A 
is compiled, the compiler has to know how big objects of type B are. So the
full 
declaration has to go into the spec.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RE: Ada 0y wish list:
  2001-02-15 19:16 Ada 0y wish list: "with private" Beard, Frank
@ 2001-02-15 20:03 ` Ted Dennison
  0 siblings, 0 replies; 3+ messages in thread
From: Ted Dennison @ 2001-02-15 20:03 UTC (permalink / raw)


In article <mailman.982264694.19416.comp.lang.ada@ada.eu.org>, Beard, Frank
says...
>
>I disagree.  If the compiler treated the deferred type
>as a "by
reference" type then there wouldn't be a problem.
>It would be similar to an
access type without the requirement
>of allocation/deallocation, null checks,
etc.
>
>When a variable of type B is declared, the compiler will
>always pass it
by reference (by address), which is the
>equivalent of passing an access
type.

But passing parameters isn't the only issue. You also have to generate
code for
allocating stack space for objects of that type. In extreme cases, you
might
even need to create an array type or do something else relatively static
based
on the type's 'size. How are you going to do that without needing that
code to
be regenerated whenever the source file containing the definition of
the
object's size is recompiled?


---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: RE: Ada 0y wish list:
@ 2001-02-15 21:00 Beard, Frank
  0 siblings, 0 replies; 3+ messages in thread
From: Beard, Frank @ 2001-02-15 21:00 UTC (permalink / raw)
  To: 'comp.lang.ada@ada.eu.org'

What I had envisioned is that it would work very similar
to an access type.  However stack space is controlled for
an access type would be the same way to control the stack
space for the deferred by reference type.

As for the size, it would deviate slightly from access types,
in that to get the size of an access type it is X.all'size.
For the deferred type it would still be X'size, because the
compiler would know that it's a deferred type and do the
X.all'size equivalent, transparent to the user.

The Alsys compiler on the LynxOs documented that if a
subprograms variable's size was larger than 2048 is would
allocate it from the heap; otherwise, it would allocate
it from the stack.  Alsys made that decision based on the
size, so why can't that decision be made based on the type.
Then there would never be a stack issue.  Again, it would
be similar to an access type.

If the unit is recompiled, then the executable has to be
rebound.  Since the internal variable tables have been
updated, the bind (link) should resolve the new sizes.

Frank

-----Original Message-----
From: Ted Dennison [mailto:dennison@telepath.com]
Sent: Thursday, February 15, 2001 3:04 PM
To: comp.lang.ada@ada.eu.org
Subject: Re: RE: Ada 0y wish list: 


But passing parameters isn't the only issue. You also have to generate
code for
allocating stack space for objects of that type. In extreme cases, you
might
even need to create an array type or do something else relatively static
based
on the type's 'size. How are you going to do that without needing that
code to
be regenerated whenever the source file containing the definition of
the
object's size is recompiled?


---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com

_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-02-15 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-15 19:16 Ada 0y wish list: "with private" Beard, Frank
2001-02-15 20:03 ` RE: Ada 0y wish list: Ted Dennison
  -- strict thread matches above, loose matches on Subject: below --
2001-02-15 21:00 Beard, Frank

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