comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: no, it can't be, there's no "with procedure instance_of_generic_procedure is new generic_procedure;" ? Impossible !
Date: Fri, 13 Apr 2018 05:34:28 -0700 (PDT)
Date: 2018-04-13T05:34:28-07:00	[thread overview]
Message-ID: <c5ca4f5c-65db-4e6c-bfc1-15dc903a380b@googlegroups.com> (raw)
In-Reply-To: <e0a89dde-ed5f-4814-b7f9-73ecd0c6d466@googlegroups.com>

It was lost in the huge list of meaningless stuff... I read it, and LOVE IT. Everything is clear from the get-go. But I do have some comments and suggestions. Probably you will find them silly or unrealistic, but please bear with it and tell me your opinion.
From your AI the only thing I’m not a huge fan of, is the use of ... "USE".

I'll make them here, so that people might review them and scold me on how silly I am (I'm prepared, it's ok...).

1) defaults for types themselves :
      Type Item_type is private or use some_known_type; Anything might be provided in default or by the user, but the generic might only use the properties mentioned in the contract (here, being definite, non-limited and non-abstract).

Honestly why isn't it already allowed ? Implementation hurdle ?

2)  with Package Object_Stack  is new Generic_Stack(PostScript_Object)
                 or use Generic_stack (Postscript_object);
Granted this one’s not perfect: there's a repetition, but it doesn't say exactly the same: first "generic_stack(...)" is a contract, the second one is the default indication.
I stumbled on the rule « It is all or nothing: if you specify the generic parameters, you must specify all of them. Similarly, if you specify no parameters and no box, then all the generic formal parameters of Q must have defaults. The actual package must, of course, match these constraints. » (ada wikibook). I don’t know why they set that… How would that be difficult to implement to allow some parameters to be given or others let to default, provided named association is used for both kinds, to remove any ambiguity ?
IF that rule could disappear, one could write :
with package Object_Stack is new Generic_Stack(Item_type => PostScript_Object, others => <>  [others parameters let to default] or use Generic_Stack([complete parameters list here])
or :
with package Object_Stack is new Generic_Stack(others => <> [or simply <>])  or use Generic_Stack(…) ;
Much more useful than before.

  reply	other threads:[~2018-04-13 12:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08  0:32 no, it can't be, there's no "with procedure instance_of_generic_procedure is new generic_procedure;" ? Impossible ! Mehdi Saada
2018-04-08  6:50 ` J-P. Rosen
2018-04-09 23:43   ` Shark8
2018-04-08 11:15 ` Mehdi Saada
2018-04-08 11:46   ` Jere
2018-04-08 13:47     ` Mehdi Saada
2018-04-12  8:56 ` Marius Amado-Alves
2018-04-12 10:14   ` Mehdi Saada
2018-04-13  0:37     ` Shark8
2018-04-13 12:34       ` Mehdi Saada [this message]
2018-04-13 15:57         ` Mehdi Saada
2018-04-13 23:59           ` Randy Brukardt
2018-04-14  0:00         ` Randy Brukardt
2018-04-14  6:00           ` Mehdi Saada
replies disabled

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