Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: Generic for...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 5646 of 5827
Post > Topic >>

Re: Generic formals - meanings and Wikibook suggestion

by "Dmitry A. Kazakov" <mailbox@[EMAIL PROTECTED] > Apr 7, 2008 at 12:19 PM

On Mon, 7 Apr 2008 02:25:06 -0700 (PDT), Maciej Sobczak wrote:

> The following table:
> 
>
http://en.wikibooks.org/wiki/Ada_Programming/Generics#Generic_formal_types
> 
> is extremely useful with generics and provides invaluable help when
> writing or reading generic code.
> 
> (another way of putting it is that the syntax for generics is just
> broken ;-) )

Broken syntax fits to a broken concept. (:-))

Formal generic types try to express the contract on the actual type. The
idea was to make the generic formal part resembling concrete type
declarations. The problem is that the former defines a set of types
(class,
we would say now), rather than just one type. 

> What is missing from this table is the full meaning of the basic:
> 
> type T is private;
> 
> This basic form is used in many places - even on the same Wikibook
> page.
> 
> What is the exact meaning of this basic form? What knowledge about T
> is expressed this way?

That the contract of T includes (I don't care about wording in strictly
Ada
terms):

1. Default constructor
2. Assignment / initialization
3. "=" and "/="
4. new
5. some attributes, I am too lazy to sort out

> From AARM I conclude that it covers all non-limited types, but
> Wikibook provides the same description (second row in the table) for:
> 
> type T (<>) is private;
> 
> Is there any difference between the two?

Yes, it drops the position 1, so the actual of T can be indefinite.

> (hint: add the basic form to the same table in the Wikibook?)

As well as other cases missing. For example formal access to subprogram:

type T is access function ...;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
 




 3 Posts in Topic:
Generic formals - meanings and Wikibook suggestion
Maciej Sobczak <see.my  2008-04-07 02:25:06 
Re: Generic formals - meanings and Wikibook suggestion
christoph.grein@[EMAIL PR  2008-04-07 03:08:38 
Re: Generic formals - meanings and Wikibook suggestion
"Dmitry A. Kazakov&q  2008-04-07 12:19:14 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 0:02:16 CDT 2008.