Jump to page: 1 24  
Page
Thread overview
template instantiation (suggestion)
Dec 01, 2003
Heretic
Dec 01, 2003
Andy Friesen
Dec 01, 2003
Ben Hinkle
Dec 01, 2003
Sean L. Palmer
Dec 01, 2003
Patrick Down
Dec 01, 2003
Charles Sanders
Dec 01, 2003
davepermen
Dec 01, 2003
Sean L. Palmer
Dec 01, 2003
Hauke Duden
Dec 01, 2003
Georg Wrede
Dec 03, 2003
Antti Sykäri
Dec 01, 2003
Antti Sykäri
Dec 01, 2003
Charles Sanders
Dec 01, 2003
Mark J. Brudnak
Dec 01, 2003
Ant
Dec 03, 2003
jonth
Re: $ as array end token (was template instantiation)
Dec 01, 2003
davepermen
Dec 02, 2003
Mark Brudnak
Dec 03, 2003
Ilya Minkov
Dec 04, 2003
Jon Thoroddsen
Dec 04, 2003
Ilya Minkov
Dec 04, 2003
Sean L. Palmer
Dec 05, 2003
Mark J. Brudnak
Dec 05, 2003
Hauke Duden
Dec 05, 2003
Sean L. Palmer
Dec 02, 2003
Sean L. Palmer
Dec 03, 2003
Antti Sykäri
Dec 01, 2003
brad beveridge
Dec 01, 2003
Sean L. Palmer
Dec 02, 2003
Felix
Dec 02, 2003
J Anderson
Dec 02, 2003
Felix
Dec 02, 2003
J Anderson
Dec 03, 2003
Charles Sanders
Dec 02, 2003
Patrick Down
Dec 19, 2003
Walter
Dec 01, 2003
Georg Wrede
December 01, 2003
yo again. i`ve finally read the D language specification, lol. the more i read
bout d, the better it seems. however there`s one thing that annoys me.
templates have to be instantiated with the "instance Name(ARG)" expression... i
dont quite like it, wouldnt it be better to use Name<ARG> ? it is still context
independent and much faster to type, more comfortable and stuff. in c++ i have a
function alias_cast<T>(char*) that works as a object reference. i add aliases to
objects, but not aliases in teh D way. i name objects with character strings and
i`m able to access them this way. in D, i`d have to write instance
alias_cast(T).f(char*) whis is quite tedious to type and is less clear :/
maybe i`m missing something, pls correct me then, but consider my suggestion of
using the triangular braces for template instantiation...


December 01, 2003
Heretic wrote:
> yo again. i`ve finally read the D language specification, lol. the more i read
> bout d, the better it seems. however there`s one thing that annoys me.
> templates have to be instantiated with the "instance Name(ARG)" expression... i
> dont quite like it, wouldnt it be better to use Name<ARG> ? it is still context
> independent and much faster to type, more comfortable and stuff. in c++ i have a
> function alias_cast<T>(char*) that works as a object reference. i add aliases to
> objects, but not aliases in teh D way. i name objects with character strings and
> i`m able to access them this way. in D, i`d have to write instance
> alias_cast(T).f(char*) whis is quite tedious to type and is less clear :/
> maybe i`m missing something, pls correct me then, but consider my suggestion of
> using the triangular braces for template instantiation...

The trouble with Name<ARG> is (as I understand it) that it requires semantic analysis to figure out whether < and > are being used as angle brackets, or as greater-than/less-than in an expression.

Plain-old parenths might cut it, but that makes what's going on less obvious.  Braces already have meaning as well.

I agree that template instantiation should be much less verbose; it's just a matter of working out a good syntax for it.

 -- andy

December 01, 2003
"Andy Friesen" <andy@ikagames.com> wrote in message news:bqfm1p$14ks$1@digitaldaemon.com...
> Heretic wrote:
> > yo again. i`ve finally read the D language specification, lol. the more
i read
> > bout d, the better it seems. however there`s one thing that annoys me. templates have to be instantiated with the "instance Name(ARG)"
expression... i
> > dont quite like it, wouldnt it be better to use Name<ARG> ? it is still
context
> > independent and much faster to type, more comfortable and stuff. in c++
i have a
> > function alias_cast<T>(char*) that works as a object reference. i add
aliases to
> > objects, but not aliases in teh D way. i name objects with character
strings and
> > i`m able to access them this way. in D, i`d have to write instance
> > alias_cast(T).f(char*) whis is quite tedious to type and is less clear
:/
> > maybe i`m missing something, pls correct me then, but consider my
suggestion of
> > using the triangular braces for template instantiation...
>
> The trouble with Name<ARG> is (as I understand it) that it requires semantic analysis to figure out whether < and > are being used as angle brackets, or as greater-than/less-than in an expression.

Plus in C++ "foo<bar<T>>" needs to be "foo<bar<T> >" with a space between the last two >'s since >> is the right-shift operator. This is a nasty gotcha.

> Plain-old parenths might cut it, but that makes what's going on less obvious.  Braces already have meaning as well.
>
> I agree that template instantiation should be much less verbose; it's just a matter of working out a good syntax for it.
>
>   -- andy
>


December 01, 2003
In article <bqfm1p$14ks$1@digitaldaemon.com>, Andy Friesen says...
>
>Heretic wrote:
>> yo again. i`ve finally read the D language specification, lol. the more i read
>> bout d, the better it seems. however there`s one thing that annoys me.
>> templates have to be instantiated with the "instance Name(ARG)" expression... i
>> dont quite like it, wouldnt it be better to use Name<ARG> ? it is still context
>> independent and much faster to type, more comfortable and stuff. in c++ i have a
>> function alias_cast<T>(char*) that works as a object reference. i add aliases to
>> objects, but not aliases in teh D way. i name objects with character strings and
>> i`m able to access them this way. in D, i`d have to write instance
>> alias_cast(T).f(char*) whis is quite tedious to type and is less clear :/
>> maybe i`m missing something, pls correct me then, but consider my suggestion of
>> using the triangular braces for template instantiation...
>
>The trouble with Name<ARG> is (as I understand it) that it requires semantic analysis to figure out whether < and > are being used as angle brackets, or as greater-than/less-than in an expression.
>
>Plain-old parenths might cut it, but that makes what's going on less obvious.  Braces already have meaning as well.
>
>I agree that template instantiation should be much less verbose; it's just a matter of working out a good syntax for it.

If we are going to keep explicit instantiation I think it would be good to replace the instance keyword with a symbol like '$'

template Foo(Type)
{
void Bar(Type a) { }
}

$Foo(int).Bar(12);

alias $Foo(int).Bar BarInt;







December 01, 2003
Cool idea!  $ feels a little to much like 'interpolation' to me, but this sounds very cool ( if we want to keep the explicit , why do we want this again ?  I dont use templates that much sry )

C

"Patrick Down" <Patrick_member@pathlink.com> wrote in message news:bqftct$1gqe$1@digitaldaemon.com...
> In article <bqfm1p$14ks$1@digitaldaemon.com>, Andy Friesen says...
> >
> >Heretic wrote:
> >> yo again. i`ve finally read the D language specification, lol. the more
i read
> >> bout d, the better it seems. however there`s one thing that annoys me. templates have to be instantiated with the "instance Name(ARG)"
expression... i
> >> dont quite like it, wouldnt it be better to use Name<ARG> ? it is still
context
> >> independent and much faster to type, more comfortable and stuff. in c++
i have a
> >> function alias_cast<T>(char*) that works as a object reference. i add
aliases to
> >> objects, but not aliases in teh D way. i name objects with character
strings and
> >> i`m able to access them this way. in D, i`d have to write instance
> >> alias_cast(T).f(char*) whis is quite tedious to type and is less clear
:/
> >> maybe i`m missing something, pls correct me then, but consider my
suggestion of
> >> using the triangular braces for template instantiation...
> >
> >The trouble with Name<ARG> is (as I understand it) that it requires semantic analysis to figure out whether < and > are being used as angle brackets, or as greater-than/less-than in an expression.
> >
> >Plain-old parenths might cut it, but that makes what's going on less obvious.  Braces already have meaning as well.
> >
> >I agree that template instantiation should be much less verbose; it's just a matter of working out a good syntax for it.
>
> If we are going to keep explicit instantiation I think it would be good to replace the instance keyword with a symbol like '$'
>
> template Foo(Type)
> {
> void Bar(Type a) { }
> }
>
> $Foo(int).Bar(12);
>
> alias $Foo(int).Bar BarInt;
>
>
>
>
>
>
>


December 01, 2003
i don't want to keep it explicit with a keyword or token.

oh, and i want to get rid of templates that are like namespaces. eighter we get namespaces, and can add template parameters to it, or no namespaces at all.

namespaces or not, i want templates for functions, and for classes.

instance Swap(int).call(a,b); is just plain stupid..

instance(int) swap(a,b); would be nice, for example..

but

swap(a,b); is still unbeatable....


oh, and have i said i'd like to promote a swap operator?

a <=> b; //swaps a and b


now THAT was offtopic:D




In article <bqfu00$1hlj$1@digitaldaemon.com>, Charles Sanders says...
>
>Cool idea!  $ feels a little to much like 'interpolation' to me, but this sounds very cool ( if we want to keep the explicit , why do we want this again ?  I dont use templates that much sry )
>
>C
>
>"Patrick Down" <Patrick_member@pathlink.com> wrote in message news:bqftct$1gqe$1@digitaldaemon.com...
>> In article <bqfm1p$14ks$1@digitaldaemon.com>, Andy Friesen says...
>> >
>> >Heretic wrote:
>> >> yo again. i`ve finally read the D language specification, lol. the more
>i read
>> >> bout d, the better it seems. however there`s one thing that annoys me. templates have to be instantiated with the "instance Name(ARG)"
>expression... i
>> >> dont quite like it, wouldnt it be better to use Name<ARG> ? it is still
>context
>> >> independent and much faster to type, more comfortable and stuff. in c++
>i have a
>> >> function alias_cast<T>(char*) that works as a object reference. i add
>aliases to
>> >> objects, but not aliases in teh D way. i name objects with character
>strings and
>> >> i`m able to access them this way. in D, i`d have to write instance
>> >> alias_cast(T).f(char*) whis is quite tedious to type and is less clear
>:/
>> >> maybe i`m missing something, pls correct me then, but consider my
>suggestion of
>> >> using the triangular braces for template instantiation...
>> >
>> >The trouble with Name<ARG> is (as I understand it) that it requires semantic analysis to figure out whether < and > are being used as angle brackets, or as greater-than/less-than in an expression.
>> >
>> >Plain-old parenths might cut it, but that makes what's going on less obvious.  Braces already have meaning as well.
>> >
>> >I agree that template instantiation should be much less verbose; it's just a matter of working out a good syntax for it.
>>
>> If we are going to keep explicit instantiation I think it would be good to replace the instance keyword with a symbol like '$'
>>
>> template Foo(Type)
>> {
>> void Bar(Type a) { }
>> }
>>
>> $Foo(int).Bar(12);
>>
>> alias $Foo(int).Bar BarInt;
>>
>>
>>
>>
>>
>>
>>
>
>


December 01, 2003
C# 2.0 has managed to address that little problem.  It's not unsolvable.

Sean

"Ben Hinkle" <bhinkle4@juno.com> wrote in message news:bqfq0a$1bl9$1@digitaldaemon.com...
> Plus in C++ "foo<bar<T>>" needs to be "foo<bar<T> >" with a space between the last two >'s since >> is the right-shift operator. This is a nasty gotcha.


December 01, 2003
"$" is better than "instance".  Instance is just too wordy.

I feel like the people designing the D templates have never done much generic programming in C++.

Sean

"Patrick Down" <Patrick_member@pathlink.com> wrote in message news:bqftct$1gqe$1@digitaldaemon.com...
> In article <bqfm1p$14ks$1@digitaldaemon.com>, Andy Friesen says...
> >
> >Heretic wrote:
> >> yo again. i`ve finally read the D language specification, lol. the more
i read
> >> bout d, the better it seems. however there`s one thing that annoys me. templates have to be instantiated with the "instance Name(ARG)"
expression... i
> >> dont quite like it, wouldnt it be better to use Name<ARG> ? it is still
context
> >> independent and much faster to type, more comfortable and stuff. in c++
i have a
> >> function alias_cast<T>(char*) that works as a object reference. i add
aliases to
> >> objects, but not aliases in teh D way. i name objects with character
strings and
> >> i`m able to access them this way. in D, i`d have to write instance
> >> alias_cast(T).f(char*) whis is quite tedious to type and is less clear
:/
> >> maybe i`m missing something, pls correct me then, but consider my
suggestion of
> >> using the triangular braces for template instantiation...
> >
> >The trouble with Name<ARG> is (as I understand it) that it requires semantic analysis to figure out whether < and > are being used as angle brackets, or as greater-than/less-than in an expression.
> >
> >Plain-old parenths might cut it, but that makes what's going on less obvious.  Braces already have meaning as well.
> >
> >I agree that template instantiation should be much less verbose; it's just a matter of working out a good syntax for it.
>
> If we are going to keep explicit instantiation I think it would be good to replace the instance keyword with a symbol like '$'
>
> template Foo(Type)
> {
> void Bar(Type a) { }
> }
>
> $Foo(int).Bar(12);
>
> alias $Foo(int).Bar BarInt;


December 01, 2003
Actually I've been wishing lately for template namespaces in C++.  ;)

I want a swap, min, and max operator.

swap:     a <=> b;
min:   smaller = a <? b;
max:   larger = a >? b;

And yes I want to be able to overload them.

I may want an overloadable abs operator as well.

abs:  magnitude = |+| a;

In C++ I'm overloading unary plus to do this.  ;)

Sean

"davepermen" <davepermen_member@pathlink.com> wrote in message news:bqfvdu$1jqp$1@digitaldaemon.com...
> i don't want to keep it explicit with a keyword or token.
>
> oh, and i want to get rid of templates that are like namespaces. eighter
we get
> namespaces, and can add template parameters to it, or no namespaces at
all.
>
> namespaces or not, i want templates for functions, and for classes.
>
> instance Swap(int).call(a,b); is just plain stupid..
>
> instance(int) swap(a,b); would be nice, for example..
>
> but
>
> swap(a,b); is still unbeatable....
>
>
> oh, and have i said i'd like to promote a swap operator?
>
> a <=> b; //swaps a and b
>
>
> now THAT was offtopic:D


December 01, 2003
In article <bqfu00$1hlj$1@digitaldaemon.com>, Charles Sanders wrote:
> Cool idea!  $ feels a little to much like 'interpolation' to me, but this sounds very cool ( if we want to keep the explicit , why do we want this again ?  I dont use templates that much sry )

To me, $ feels for some reason like perl...

-Antti

« First   ‹ Prev
1 2 3 4