From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Parameterless generic instance in place of opaque type instance
Date: Sun, 28 Jul 2013 07:49:36 +0200
Date: 2013-07-28T07:49:36+02:00 [thread overview]
Message-ID: <op.w0w3syewule2fv@cardamome> (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
next reply other threads:[~2013-07-28 5:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-28 5:49 Yannick Duchêne (Hibou57) [this message]
2013-07-28 6:36 ` Parameterless generic instance in place of opaque type instance 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox