comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.plus-bug.tsoh@maps.futureapps.de>
Subject: Re: User-defined type attributes (replacing genericity)
Date: Fri, 14 Mar 2008 17:58:46 +0100
Date: 2008-03-14T17:58:46+01:00	[thread overview]
Message-ID: <1205513926.7434.3.camel@K72> (raw)
In-Reply-To: <k4zvct2zqh5t.10e4n7n078983.dlg@40tude.net> <d9065e94-8586-4889-b5c7-a8ca9e8f2248@d21g2000prf.googlegroups.com> <p0joauyj6p7$.z2nuhn0t1c78.dlg@40tude.net> <30f629fd-69d3-4d40-995f-9933f52b8dad@s37g2000prg.googlegroups.com> <965suhjl0bxt$.74se2ylyksin.dlg@40tude.net> <frcppv$de8$1@jacob-sparre.dk> <pqup5kf1u34t$.19kwms4bw12hs.dlg@40tude.net> <1205505100.6445.60.camel@K72> <k4zvct2zqh5t.10e4n7n078983.dlg@40tude.net>

On Fri, 2008-03-14 at 15:48 +0100, Dmitry A. Kazakov wrote:

> > I assume your answer to what follows will be that Ada semantics
> > should be put under programmer control,
> 
> What's wrong with having control over the semantics?

(Control over the semantics of the language. I'm not a compiler,
and I'm not imagining I am as good as someone who can routinely
master the advanced parts of implementing Ada in user programs.
That is what I think will be wrong.

It is certainly possible to imagine some meta-flavoring for
Ada. But I don't want to inspect such pieces of sophistication
when they come out of the hands of ordinary programmers
and have errors. There will be at least one more
level of linguistic indirection between me and the LRM:
the programmer's language interpretation as implemented in
his semantics control.)


> No, what you need is an interface implemented by both. You need to declare
> Simple implementing Ordered. That will tell the compiler that the
> predefined "<=" is an implementation of Ordered's "<=".

Actually, it doesn't matter whether "<=" is predefined. It could
just as well have been a user defined "<=". The Foo(...'Class) would
have had one one general ("generic"?) implementation of Is_Highest,
as described. This Is_Highest will have no specialization, but
it will feature highly stylized indirection, dispatching to the
implementing code for the respective "<=".


> > Without generics, there is only one Is_Highest, as might be
> > expected. 
> 
> Why there have to be two? The whole idea of generics was to have *one*
> generic body. This is why it is called generic [programming].

I *can* have and I *did* have just one body in *source* code.
We both know that Ada does not anywhere require that generics
must not yield more than one lists of object code per
generic. This would seem like a stupid restriction, one that
I think no one has wanted to put in the minds of the language
makers.


> If you want to constrain the dispatching table
> to the diagonal

I don't want that language to inflict a dispatching table
on me when that offers no advantage at all!

- I don't need any dispatching here,
- My code is more efficient without it,
- Review of the generated code is simpler because
  there are fewer indirections.
- There still is abstraction.

If that doesn't count as advantages ...


>  Do not sell a limitation of generics to a
> certain type of constraint as genuine advantage.

>From looking at generated code, the genuine advantage seems
to be the total absence of dispatching code.
Absence of code whose major contribution can, by the impression
of the assembly listing, roughly be expressed as

 X.all.Call_Maker.all.Invoke

instead of

 X.all.Call

in the generic case





  parent reply	other threads:[~2008-03-14 16:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 18:58 User-defined type attributes Eric Hughes
2008-03-12 21:23 ` Dmitry A. Kazakov
2008-03-13 18:32   ` Eric Hughes
2008-03-13 19:58     ` Dmitry A. Kazakov
2008-03-14  1:46       ` Randy Brukardt
2008-03-14  1:46       ` Randy Brukardt
2008-03-14  1:46       ` Randy Brukardt
2008-03-14  9:00         ` Dmitry A. Kazakov
2008-03-14 14:36           ` User-defined type attributes (replacing genericity) Georg Bauhaus
2008-03-15  3:04           ` User-defined type attributes Randy Brukardt
2008-03-15  9:33             ` Dmitry A. Kazakov
2008-03-14 14:31         ` User-defined type attributes (replacing genericity) Georg Bauhaus
2008-03-14 14:48           ` Dmitry A. Kazakov
2008-03-14 17:51             ` Eric Hughes
2008-03-14 18:58               ` Dmitry A. Kazakov
2008-03-14 20:19                 ` Eric Hughes
2008-03-15  4:01               ` Randy Brukardt
2008-03-14 16:58           ` Georg Bauhaus [this message]
2008-03-14 18:39             ` Dmitry A. Kazakov
2008-03-15  9:39               ` Dmitry A. Kazakov
2008-03-14  3:55       ` User-defined type attributes Eric Hughes
2008-03-14  9:01         ` Dmitry A. Kazakov
2008-03-14 18:04           ` Eric Hughes
2008-03-14  1:46 ` Randy Brukardt
2008-03-14  4:41   ` Eric Hughes
2008-03-15  3:20     ` Randy Brukardt
2008-03-17  4:38       ` Eric Hughes
2008-03-17 21:03         ` Randy Brukardt
2008-03-17 21:58           ` Eric Hughes
replies disabled

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