comp.lang.ada
 help / color / mirror / Atom feed
* Generic library design
@ 2018-04-06 13:22 Marius Amado-Alves
  2018-04-07  2:32 ` Randy Brukardt
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Amado-Alves @ 2018-04-06 13:22 UTC (permalink / raw)


Hello hive mind. Designing a few generic libraries involving real and complex number types and arrays thereof. Undecided as to the type of generic parameter(s). Namely:

When should the parameter(s) be the base real type like (examples drawn from the standard, please extrapolate)

   generic
      type Real is digits <>;
   package Ada.Numerics.Generic_Real_Arrays is
   ...

with the necessary sidekicks e.g. Generic_Elementary_Functions instantiated internally,

when should it be one or more packages like 

   generic
      with package Real_Arrays   is new
         Ada.Numerics.Generic_Real_Arrays   (<>);
      use Real_Arrays;
      with package Complex_Types is new
         Ada.Numerics.Generic_Complex_Types (Real);
      use Complex_Types;
   package Ada.Numerics.Generic_Complex_Arrays is
   ...

with the set or a subset of the necessary entities "pre-instantiated" by the user? Is there a design "rule"?

Consider the running example: why is Ada.Numerics.Generic_Complex_Arrays parametrized by packages, instead of just a Real type and then instantiate the packages intarnally?

And are compilers smart enough to merge identical instances w.r.t. to their generic arguments? Maybe with help of qualification pragmas telling there is no state?

No need to answer to all questions at once:-)

Thanks a lot.


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

* Re: Generic library design
  2018-04-06 13:22 Generic library design Marius Amado-Alves
@ 2018-04-07  2:32 ` Randy Brukardt
  2018-04-12  8:21   ` Marius Amado-Alves
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Randy Brukardt @ 2018-04-07  2:32 UTC (permalink / raw)



"Marius Amado-Alves" <amado.alves@gmail.com> wrote in message 
news:1d9faa0f-d3d7-4eb4-aa88-b50ed1e9aac3@googlegroups.com...
...
> Consider the running example: why is Ada.Numerics.Generic_Complex_Arrays
> parametrized by packages, instead of just a Real type and then instantiate 
> the
> packages intarnally?

When you do that, you are insisting on a new complex type with each 
instantiation of the complex arrays package. But perhaps you want one 
complex type and several complex array instantiations. (That makes more 
sense when the index subtype is a parameter to the generic; one certainly 
might want arrays indexed by different types.)

> And are compilers smart enough to merge identical instances w.r.t.
>to their generic arguments? Maybe with help of qualification pragmas
>telling there is no state?

Depends on the compiler. Janus/Ada shares all generic bodies (with all of 
the overhead that entails), so it is an extreme version. Other compilers 
don't try to share anything. Some are somewhere in the middle.

Note that argubly sharing based on generic parameters is (was?) patented and 
not usable by implementers without legal issues.

> No need to answer to all questions at once:-)

OK, the above is enough. :-)

              Randy.


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

* Re: Generic library design
  2018-04-07  2:32 ` Randy Brukardt
@ 2018-04-12  8:21   ` Marius Amado-Alves
  2018-04-12 10:23   ` Marius Amado-Alves
  2018-04-12 15:32   ` Dan'l Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Marius Amado-Alves @ 2018-04-12  8:21 UTC (permalink / raw)


Thanks, very informative and useful.

(I create patentable ideas as I breath...)

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

* Re: Generic library design
  2018-04-07  2:32 ` Randy Brukardt
  2018-04-12  8:21   ` Marius Amado-Alves
@ 2018-04-12 10:23   ` Marius Amado-Alves
  2018-04-12 15:41     ` Dan'l Miller
  2018-04-12 15:32   ` Dan'l Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Marius Amado-Alves @ 2018-04-12 10:23 UTC (permalink / raw)


Thanks, very informative and useful.

(I create patentable ideas as I breathe...)


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

* Re: Generic library design
  2018-04-07  2:32 ` Randy Brukardt
  2018-04-12  8:21   ` Marius Amado-Alves
  2018-04-12 10:23   ` Marius Amado-Alves
@ 2018-04-12 15:32   ` Dan'l Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Dan'l Miller @ 2018-04-12 15:32 UTC (permalink / raw)


On Friday, April 6, 2018 at 9:32:30 PM UTC-5, Randy Brukardt wrote:
> Note that argubly sharing based on generic parameters is (was?) patented and 
> not usable by implementers without legal issues.

Would you know any clues on how to track that patent down?  Assignee corporation?  Inventors?  Patent number?  Btw, if it isn't RR Software and that patent isn't decades old, then either they patented a significantly different technique or Janus Ada's long-standing capability on this topic clearly invalidates their patent as their mere mimicking of long-standing & widely-disseminated existing practice within Janus Ada, assuming that decades old versions of publicly-for-sale Janus Ada are still extant and still execute.

Perhaps on a different note, I see that Oracle has been quite active in recent years regarding the application for patents in the parameterized-type conceptual-space regarding compilers.  Apparently a strategy over there is to try to assure that only Java has all the cool toys in their toybox, leaving Ada, C++, OCaml, C#, and so forth with older-era technology for 20 years.  One inventor's name keeps recurring on nearly every one of those patents.

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

* Re: Generic library design
  2018-04-12 10:23   ` Marius Amado-Alves
@ 2018-04-12 15:41     ` Dan'l Miller
  0 siblings, 0 replies; 6+ messages in thread
From: Dan'l Miller @ 2018-04-12 15:41 UTC (permalink / raw)


On Thursday, April 12, 2018 at 5:23:28 AM UTC-5, Marius Amado-Alves wrote:
> Thanks, very informative and useful.
> 
> (I create patentable ideas as I breathe...)

Btw, (wishful) ideas themselves are not patentable.  Only the apparatus(es) and method(s) that bring those ideas into fruition (as reified reality) are patentable.  (And thus many patents are able to be bypassed via a different apparatus and/or different method to accomplish the idea's outcome/wish—and thus why new patents on new variants on paperclips are often valid fresh inventions:  the wishful idea of a paperclip that doesn't fall off isn't what is being patented; the apparatus or method for •how• to increase friction of paperclip to paper is what is being patented.)

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

end of thread, other threads:[~2018-04-12 15:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-06 13:22 Generic library design Marius Amado-Alves
2018-04-07  2:32 ` Randy Brukardt
2018-04-12  8:21   ` Marius Amado-Alves
2018-04-12 10:23   ` Marius Amado-Alves
2018-04-12 15:41     ` Dan'l Miller
2018-04-12 15:32   ` Dan'l Miller

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