Google video about consepts
Lutger
lutger.blijdestijn at gmail.com
Mon Apr 9 03:37:45 PDT 2007
janderson wrote:
> Knud Soerensen wrote:
>> Hi
>> I found this interesting google video.
>>
>> Concepts: Extending C++ Templates For Generic Programming
>> http://video.google.com/videoplay?docid=-1790714981047186825&hl=en
This is interesting, I (tried to) read the proposal, but this video
makes it clear. Very inspiring.
> My Quick Summary:
>
> Concepts as restrictions:
>
> Essentially this is a static contract. Static assert if you will. It
> could probably be done in other ways. However it does bring attention
> to template verification helper functions.
The cool thing, as I understand it, is that it works like interfaces:
it's not only that such and such must be available by T, but that the
implementation is restricted to using these only - which the compiler
must check. The latter seems more important.
I don't see how one is going to do this with current D in a clean way,
though it should be possible to come close.
> Concept_Maps
> Convert one thing to another so that it can be used in a template.
>
> Foreach Concepts.
> There seems to be some special compiler concepts that you can't define
> inside the library. I'm not 100% clear on these. Somehow the
> InputIterator is defined such that the compile knows it can work with
> the new foreach. Can someone explain?
As I understand it, you can write a concept map that the compiler looks
up so any type that can be made to fit the requirements can be
converted. In the same way pointers can be made to adhere to the
iterator concept. I guess it is similar to how you can iterate over
delegates in D.
> I wonder how close we can get to a simple D version with current syntax.
> And if we can't how can we improve D's syntax so we can.
>
> -Joel
Me too. At first I thought most could be achieved by current features,
but I'm not so sure now. I think at least the macro feature is needed,
and then someone with a solid understanding could implement most of it
in a library. Although perhaps eventually some kind of language support
may go a long way to achieve a sane syntax, which is a thing I think
Walter Bright is very good at...
More information about the Digitalmars-d
mailing list