comp.lang.ada
 help / color / mirror / Atom feed
* Parameterless generic instance in place of opaque type instance
@ 2013-07-28  5:49 Yannick Duchêne (Hibou57)
  2013-07-28  6:36 ` Yannick Duchêne (Hibou57)
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2013-07-28  5:49 UTC (permalink / raw)


Hi Ada designers,

An idea comes to me from time to time, and it came back to me as a  
seducing option for a package, just today.

Opaque types are nice, when simple. There are however which requires to  
pull a lot into the private part of a package. Some type may perfectly be  
singleton, so that a package may just hold all of its state instead of a  
record. Bad practice though, that's a too much sever limitation, when the  
type is not to be by nature, a singleton.

There are types, although they are not singleton by nature, whose instance  
may by nature, typically be created sparingly, and not to be stored in  
aggregates, I mean, instances of these type are typically not to be hold  
by a record or an array (just to cite these), nor have access (as in  
access type) to it.

For these types, a parameterless generic instance may be enough. I hope  
most compilers are clever enough to not duplicate machine code for each of  
these instances, and just duplicate their data (valid or invalid  
assumption?).

Just that I've not seen that pattern too much (to be honest, never), so I  
would like to know if there are people here who already did this and what  
can be reported about this pattern on the long run.

Good or bad pattern in your opinion?

My personal opinion, is that I don't see any issue with it, but to not  
have ever seen this done by any one else, make me wonder and wrinkle a  
bit, thus this thread here.


-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University


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

end of thread, other threads:[~2013-07-28 22:27 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-28  5:49 Parameterless generic instance in place of opaque type instance Yannick Duchêne (Hibou57)
2013-07-28  6:36 ` Yannick Duchêne (Hibou57)
2013-07-28  7:02   ` Yannick Duchêne (Hibou57)
2013-07-28  7:26     ` Yannick Duchêne (Hibou57)
2013-07-28  7:30 ` J-P. Rosen
2013-07-28  8:24   ` Yannick Duchêne (Hibou57)
2013-07-28 18:08     ` Shark8
2013-07-28 19:47       ` Yannick Duchêne (Hibou57)
2013-07-28 20:58         ` Shark8
2013-07-28 22:27           ` Yannick Duchêne (Hibou57)
2013-07-28 21:15         ` J-P. Rosen
2013-07-28 22:23           ` Shark8
2013-07-28 14:52 ` Robert A Duff

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