comp.lang.ada
 help / color / mirror / Atom feed
* C++0x : no 'concepts'
@ 2009-09-09 11:44 Martin
  2009-09-09 12:12 ` Georg Bauhaus
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Martin @ 2009-09-09 11:44 UTC (permalink / raw)


Crickey! How glad am Ada has strong typing and a generic contract
model!!

http://www.ddj.com/cpp/218600111

And that was going to make life 'simpler'!?!?!?

Cheers
-- Martin



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

* Re: C++0x : no 'concepts'
  2009-09-09 11:44 C++0x : no 'concepts' Martin
@ 2009-09-09 12:12 ` Georg Bauhaus
  2009-09-09 12:15   ` Martin
  2009-09-09 12:39   ` Dmitry A. Kazakov
  2009-09-09 14:49 ` Adam Beneschan
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Georg Bauhaus @ 2009-09-09 12:12 UTC (permalink / raw)


Martin schrieb:
> Crickey! How glad am Ada has strong typing and a generic contract
> model!!
> 
> http://www.ddj.com/cpp/218600111
> 
> And that was going to make life 'simpler'!?!?!?

Just saw this, addressing the question:

"The current definition of concepts and requirements for use drowns the
programmer in complexities of a magnitude not warranted by the need to
express type-checked 9constrained) generic programming."

From: Simplifying the use of concepts, linked in the article.

-

Fantasizing, could we have, in Ada,

- recursive instantiations of pure generics?
- an optional Compiler package?



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

* Re: C++0x : no 'concepts'
  2009-09-09 12:12 ` Georg Bauhaus
@ 2009-09-09 12:15   ` Martin
  2009-09-09 12:39   ` Dmitry A. Kazakov
  1 sibling, 0 replies; 13+ messages in thread
From: Martin @ 2009-09-09 12:15 UTC (permalink / raw)


On Sep 9, 1:12 pm, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:
> Martin schrieb:
>
> > Crickey! How glad am Ada has strong typing and a generic contract
> > model!!
>
> >http://www.ddj.com/cpp/218600111
>
> > And that was going to make life 'simpler'!?!?!?
>
> Just saw this, addressing the question:
>
> "The current definition of concepts and requirements for use drowns the
> programmer in complexities of a magnitude not warranted by the need to
> express type-checked 9constrained) generic programming."
>
> From: Simplifying the use of concepts, linked in the article.
>
> -
>
> Fantasizing, could we have, in Ada,
>
> - recursive instantiations of pure generics?
> - an optional Compiler package?

Similarly, there was a paper on 'implicit instantiations' - I can
think of times when that might have been v.handy...

Cheers
-- Martin



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

* Re: C++0x : no 'concepts'
  2009-09-09 12:12 ` Georg Bauhaus
  2009-09-09 12:15   ` Martin
@ 2009-09-09 12:39   ` Dmitry A. Kazakov
  2009-09-09 14:47     ` Georg Bauhaus
  1 sibling, 1 reply; 13+ messages in thread
From: Dmitry A. Kazakov @ 2009-09-09 12:39 UTC (permalink / raw)


On Wed, 09 Sep 2009 14:12:21 +0200, Georg Bauhaus wrote:

> Martin schrieb:
>> Crickey! How glad am Ada has strong typing and a generic contract
>> model!!
>> 
>> http://www.ddj.com/cpp/218600111
>> 
>> And that was going to make life 'simpler'!?!?!?
> 
> Just saw this, addressing the question:
> 
> "The current definition of concepts and requirements for use drowns the
> programmer in complexities of a magnitude not warranted by the need to
> express type-checked 9constrained) generic programming."
> 
> From: Simplifying the use of concepts, linked in the article.
> 
> -
> 
> Fantasizing, could we have, in Ada,
> 
> - recursive instantiations of pure generics?

Huh, the second edition of interfaces, now for the "Ada preprocessor"? I
read you that all instances of the same body when instantiated
automatically will be considered "same". Right?

> - an optional Compiler package?

The idea of Ada generics is that types aren't checked beyond a handful of
built-in classes like "<>", "private", "limited private" etc and operations
specified explicitly as formal parameters. This is not a contract of a type
or a set of types, that can be dealt with, e.g. constrained, extended, at
least named.

If you had truly "type-checked  & constrained" formal generic parameter,
you would not need to handle it as a subject of wild substitutions in the
generic unit. You would probably be able to use it as-is, without
instantiation...

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

* Re: C++0x : no 'concepts'
  2009-09-09 12:39   ` Dmitry A. Kazakov
@ 2009-09-09 14:47     ` Georg Bauhaus
  2009-09-09 15:42       ` Dmitry A. Kazakov
  0 siblings, 1 reply; 13+ messages in thread
From: Georg Bauhaus @ 2009-09-09 14:47 UTC (permalink / raw)


Dmitry A. Kazakov schrieb:

>> Fantasizing, could we have, in Ada,
>>
>> - recursive instantiations of pure generics?
> 
> Huh, the second edition of interfaces, now for the "Ada preprocessor"? I
> read you that all instances of the same body when instantiated
> automatically will be considered "same". Right?

No, I was thinking of this:


generic
   N : Natural := (if N = 0
                     then 1
                     else new Factorial'(N * Factorial(N - 1)));
function Factorial return Positive;

pragma Pure(Factorial);



(Very much ad hoc.)



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

* Re: C++0x : no 'concepts'
  2009-09-09 11:44 C++0x : no 'concepts' Martin
  2009-09-09 12:12 ` Georg Bauhaus
@ 2009-09-09 14:49 ` Adam Beneschan
  2009-09-09 19:26   ` sjw
  2009-09-10  0:16 ` wwilson
  2009-09-11 10:10 ` John McCabe
  3 siblings, 1 reply; 13+ messages in thread
From: Adam Beneschan @ 2009-09-09 14:49 UTC (permalink / raw)


On Sep 9, 4:44 am, Martin <martin.do...@btopenworld.com> wrote:
> Crickey! How glad am Ada has strong typing and a generic contract
> model!!
>
> http://www.ddj.com/cpp/218600111
>
> And that was going to make life 'simpler'!?!?!?

On a totally different line of thinking, isn't it a bit confusing to
call this C++0x?  I can't get past thinking that this is an incomplete
name, and they really meant to say C++0x7D9 or something like
that...  :)

(Not to mention that if they're still working on it with less than
four months to go in this year, the 0x is likely to become an
embarrassment anyway.  At least with Ada 0Y, even though the final
draft was a year or two later than originally planned, the year still
had a 0 in the third position.)

                               -- Adam




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

* Re: C++0x : no 'concepts'
  2009-09-09 14:47     ` Georg Bauhaus
@ 2009-09-09 15:42       ` Dmitry A. Kazakov
  0 siblings, 0 replies; 13+ messages in thread
From: Dmitry A. Kazakov @ 2009-09-09 15:42 UTC (permalink / raw)


On Wed, 09 Sep 2009 16:47:34 +0200, Georg Bauhaus wrote:

> Dmitry A. Kazakov schrieb:
> 
>>> Fantasizing, could we have, in Ada,
>>>
>>> - recursive instantiations of pure generics?
>> 
>> Huh, the second edition of interfaces, now for the "Ada preprocessor"? I
>> read you that all instances of the same body when instantiated
>> automatically will be considered "same". Right?
> 
> No, I was thinking of this:
> 
> generic
>    N : Natural := (if N = 0
>                      then 1
>                      else new Factorial'(N * Factorial(N - 1)));
> function Factorial return Positive;
> 
> pragma Pure(Factorial);

I see, PL/1's preprocessor:

%DO I=0 TO 255;
...  -- I don't remember the mess
%END;

Shudder.

----------------
What I meant was rather:

generic
   type Number is digit <>;
   with package Arithmetic is new Generic_Arithmetic (T);
package Generic_Vectors is ...

when Generic_Vectors is instantiated with Float it instantiates
Generic_Arithmetic as necessary. This is instead of putting an
instantiation into Generic_Vectors's declarative part because we want to
share the same instance of Generic_Arithmetic with other generic packages
instantiated with Float.

Typically you have a cloud of generic packages started with a priming type
like Float. It is a torture to instantiate them manually, inventing a
naming scheme for them, and then dealing with 1K source files resulting
from. The disaster is aggravated by instantiations within generic packages.
In the end nobody knows why the program does not compile and what is
instantiated where.

The problem with automatic instantiation is that when instances have
data/elaboration code etc, it will be a hell to tell if two instances are
same or not. The situation is identical to MI. In fact it is a form of MI,
just based on the static polymorphism.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

* Re: C++0x : no 'concepts'
  2009-09-09 14:49 ` Adam Beneschan
@ 2009-09-09 19:26   ` sjw
  0 siblings, 0 replies; 13+ messages in thread
From: sjw @ 2009-09-09 19:26 UTC (permalink / raw)


On Sep 9, 3:49 pm, Adam Beneschan <a...@irvine.com> wrote:

> (Not to mention that if they're still working on it with less than
> four months to go in this year, the 0x is likely to become an
> embarrassment anyway.  At least with Ada 0Y, even though the final
> draft was a year or two later than originally planned, the year still
> had a 0 in the third position.)

The '0x' is in fact a hint that you should be thinking hex here.



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

* Re: C++0x : no 'concepts'
  2009-09-09 11:44 C++0x : no 'concepts' Martin
  2009-09-09 12:12 ` Georg Bauhaus
  2009-09-09 14:49 ` Adam Beneschan
@ 2009-09-10  0:16 ` wwilson
  2009-09-10  0:45   ` Keith Thompson
  2009-09-11 10:10 ` John McCabe
  3 siblings, 1 reply; 13+ messages in thread
From: wwilson @ 2009-09-10  0:16 UTC (permalink / raw)
  To: Martin

On Wed, 09 Sep 2009 07:44:30 -0400, Martin <martin.dowie@btopenworld.com>  
wrote:

> Crickey! How glad am Ada has strong typing and a generic contract
> model!!
>
> http://www.ddj.com/cpp/218600111
>
> And that was going to make life 'simpler'!?!?!?
>
> Cheers
> -- Martin



-- 

I hate to show my ignorance, but what did the C people mean by "concepts"?


LEW
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



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

* Re: C++0x : no 'concepts'
  2009-09-10  0:16 ` wwilson
@ 2009-09-10  0:45   ` Keith Thompson
  2009-09-10 23:36     ` Stephen Leake
  0 siblings, 1 reply; 13+ messages in thread
From: Keith Thompson @ 2009-09-10  0:45 UTC (permalink / raw)


wwilson <leon.winslow@notes.udayton.edu> writes:
> On Wed, 09 Sep 2009 07:44:30 -0400, Martin
> <martin.dowie@btopenworld.com>  wrote:
>
>> Crickey! How glad am Ada has strong typing and a generic contract
>> model!!
>>
>> http://www.ddj.com/cpp/218600111
>>
>> And that was going to make life 'simpler'!?!?!?
>
> I hate to show my ignorance, but what did the C people mean by "concepts"?

C++, not C.

See <http://en.wikipedia.org/wiki/Concepts_(C%2B%2B)>.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"



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

* Re: C++0x : no 'concepts'
  2009-09-10  0:45   ` Keith Thompson
@ 2009-09-10 23:36     ` Stephen Leake
  2009-09-11  4:36       ` wwilson
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Leake @ 2009-09-10 23:36 UTC (permalink / raw)


Keith Thompson <kst-u@mib.org> writes:

> wwilson <leon.winslow@notes.udayton.edu> writes:
>> On Wed, 09 Sep 2009 07:44:30 -0400, Martin
>> <martin.dowie@btopenworld.com>  wrote:
>>
>>> Crickey! How glad am Ada has strong typing and a generic contract
>>> model!!
>>>
>>> http://www.ddj.com/cpp/218600111
>>>
>>> And that was going to make life 'simpler'!?!?!?
>>
>> I hate to show my ignorance, but what did the C people mean by "concepts"?
>
> C++, not C.
>
> See <http://en.wikipedia.org/wiki/Concepts_(C%2B%2B)>.

I think the nearest Ada equivalent is a "signature generic package
parameter". 

-- 
-- Stephe



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

* Re: C++0x : no 'concepts'
  2009-09-10 23:36     ` Stephen Leake
@ 2009-09-11  4:36       ` wwilson
  0 siblings, 0 replies; 13+ messages in thread
From: wwilson @ 2009-09-11  4:36 UTC (permalink / raw)
  To: Stephen Leake

On Thu, 10 Sep 2009 19:36:00 -0400, Stephen Leake  
<stephen_leake@stephe-leake.org> wrote:

> Keith Thompson <kst-u@mib.org> writes:
>
>> wwilson <leon.winslow@notes.udayton.edu> writes:
>>> On Wed, 09 Sep 2009 07:44:30 -0400, Martin
>>> <martin.dowie@btopenworld.com>  wrote:
>>>
>>>> Crickey! How glad am Ada has strong typing and a generic contract
>>>> model!!
>>>>
>>>> http://www.ddj.com/cpp/218600111
>>>>
>>>> And that was going to make life 'simpler'!?!?!?
>>>
>>> I hate to show my ignorance, but what did the C people mean by  
>>> "concepts"?
>>
>> C++, not C.
>>
>> See <http://en.wikipedia.org/wiki/Concepts_(C%2B%2B)>.
>
> I think the nearest Ada equivalent is a "signature generic package
> parameter".
>

Thanks to both of you.  An interesting idea.

Sorry about the typo of C for C++


lew

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



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

* Re: C++0x : no 'concepts'
  2009-09-09 11:44 C++0x : no 'concepts' Martin
                   ` (2 preceding siblings ...)
  2009-09-10  0:16 ` wwilson
@ 2009-09-11 10:10 ` John McCabe
  3 siblings, 0 replies; 13+ messages in thread
From: John McCabe @ 2009-09-11 10:10 UTC (permalink / raw)


On Wed, 9 Sep 2009 04:44:30 -0700 (PDT), Martin
<martin.dowie@btopenworld.com> wrote:

>Crickey! How glad am Ada has strong typing and a generic contract
>model!!
>
>http://www.ddj.com/cpp/218600111
>
>And that was going to make life 'simpler'!?!?!?

There was an article in Overload (an ACCU journal) about this
recently. Written by Bjarne Stroustroup (or whatever his name is). It
was, err, intriguing!



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

end of thread, other threads:[~2009-09-11 10:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-09 11:44 C++0x : no 'concepts' Martin
2009-09-09 12:12 ` Georg Bauhaus
2009-09-09 12:15   ` Martin
2009-09-09 12:39   ` Dmitry A. Kazakov
2009-09-09 14:47     ` Georg Bauhaus
2009-09-09 15:42       ` Dmitry A. Kazakov
2009-09-09 14:49 ` Adam Beneschan
2009-09-09 19:26   ` sjw
2009-09-10  0:16 ` wwilson
2009-09-10  0:45   ` Keith Thompson
2009-09-10 23:36     ` Stephen Leake
2009-09-11  4:36       ` wwilson
2009-09-11 10:10 ` John McCabe

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