Thread overview | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 23, 2004 Templates and the '!' | ||||
---|---|---|---|---|
| ||||
I just was looking at a piece of code. And while this is largely my problem, I keep reading: Foo!(int) as Foo not int. And thinking what on earth? And then remembering oh yeah templates... Why are we using the ! symbol for templates? Couldn't we use a | or something else? # isn't used, neither is @ or $. |
July 23, 2004 Re: Templates and the '!' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sha Chancellor | Sha Chancellor wrote:
> I just was looking at a piece of code. And while this is largely my problem, I keep reading:
>
> Foo!(int)
>
> as Foo not int.
>
> And thinking what on earth? And then remembering oh yeah templates...
>
> Why are we using the ! symbol for templates? Couldn't we use a | or something else? # isn't used, neither is @ or $.
I agree.
Foo!(int)
Foo|(int)
Foo:(int)
Foo@(int)
Foo#(int)
Foo$(int)
Out of the options listed, I think I like the pipe or colon declarator
the best.
The "!" symbol just naturally maps to "not" in many people's minds.
|
July 23, 2004 Re: Templates and the '!' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Berin Loritsch | you've corrupted me!(Human)
now i'll see func!(type) as a not...
never saw it before you said it, and I've been a C++ programmer for ages
Berin Loritsch wrote:
> Sha Chancellor wrote:
>
>> I just was looking at a piece of code. And while this is largely my problem, I keep reading:
>>
>> Foo!(int)
>>
>> as Foo not int.
>>
>> And thinking what on earth? And then remembering oh yeah templates...
>>
>> Why are we using the ! symbol for templates? Couldn't we use a | or something else? # isn't used, neither is @ or $.
>
>
> I agree.
>
> Foo!(int)
> Foo|(int)
> Foo:(int)
> Foo@(int)
> Foo#(int)
> Foo$(int)
>
> Out of the options listed, I think I like the pipe or colon declarator
> the best.
>
> The "!" symbol just naturally maps to "not" in many people's minds.
|
July 23, 2004 Re: Templates and the '!' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Berin Loritsch | In article <cdrvjf$2md5$1@digitaldaemon.com>, Berin Loritsch says... > >I agree. > >Foo!(int) >Foo|(int) >Foo:(int) >Foo@(int) >Foo#(int) >Foo$(int) > >Out of the options listed, I think I like the pipe or colon declarator the best. Well, would I be shot down in flames for suggesting this, rather obvious, alternative: Foo<int> Arcane Jill |
July 23, 2004 Re: Templates and the '!' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arcane Jill | In article <cds3re$2qcl$1@digitaldaemon.com>, Arcane Jill says... > >In article <cdrvjf$2md5$1@digitaldaemon.com>, Berin Loritsch says... >> >>I agree. >> >>Foo!(int) >>Foo|(int) >>Foo:(int) >>Foo@(int) >>Foo#(int) >>Foo$(int) >> >>Out of the options listed, I think I like the pipe or colon declarator the best. > >Well, would I be shot down in flames for suggesting this, rather obvious, alternative: > >Foo<int> hehe... As for the previous suggestions, the colon is used as a label specifier while pipe is not easily accessible on many international keyboards. From a purely semantic standpoint, "!" correlates much more closely with something like template instantiation than with negation. But then we're all victims of convention ;) I like it how it is. The only other one I sort of like from a visual standpoint is "$" Sean |
July 23, 2004 Re: Templates and the '!' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | Sean Kelly wrote:
> In article <cds3re$2qcl$1@digitaldaemon.com>, Arcane Jill says...
>
>>In article <cdrvjf$2md5$1@digitaldaemon.com>, Berin Loritsch says...
>>
>>>I agree.
>>>
>>>Foo!(int)
>>>Foo|(int)
>>>Foo:(int)
>>>Foo@(int)
>>>Foo#(int)
>>>Foo$(int)
>>>
>>>Out of the options listed, I think I like the pipe or colon declarator
>>>the best.
>>
>>Well, would I be shot down in flames for suggesting this, rather obvious,
>>alternative:
>>
>>Foo<int>
>
>
> hehe... As for the previous suggestions, the colon is used as a label specifier
> while pipe is not easily accessible on many international keyboards. From a
> purely semantic standpoint, "!" correlates much more closely with something like
> template instantiation than with negation. But then we're all victims of
> convention ;) I like it how it is. The only other one I sort of like from a
> visual standpoint is "$"
>
>
> Sean
>
I have to agree with Sean here. ! seems completely natural to me. Then again, I'm a Neophyte "D" Programmer: naturally biased towards all things "D".
|
July 24, 2004 Re: Templates and the '!' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrew Edwards | In article <cds80e$2u3d$1@digitaldaemon.com>, Andrew Edwards says... > >Sean Kelly wrote: >> In article <cds3re$2qcl$1@digitaldaemon.com>, Arcane Jill says... >> >>>In article <cdrvjf$2md5$1@digitaldaemon.com>, Berin Loritsch says... >>> >>>>I agree. >>>> >>>>Foo!(int) >>>>Foo|(int) >>>>Foo:(int) >>>>Foo@(int) >>>>Foo#(int) >>>>Foo$(int) >>>> >>>>Out of the options listed, I think I like the pipe or colon declarator the best. >>> >>>Well, would I be shot down in flames for suggesting this, rather obvious, alternative: >>> >>>Foo<int> >> >> >> hehe... As for the previous suggestions, the colon is used as a label specifier while pipe is not easily accessible on many international keyboards. From a purely semantic standpoint, "!" correlates much more closely with something like template instantiation than with negation. But then we're all victims of convention ;) I like it how it is. The only other one I sort of like from a visual standpoint is "$" >> >> Sean > >I have to agree with Sean here. ! seems completely natural to me. Then again, I'm a Neophyte "D" Programmer: naturally biased towards all things "D". I think I like the $ as the best alternative also. :P Foo$(int) looks good to me. |
July 24, 2004 Re: Templates and the '!' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arcane Jill | Arcane Jill wrote: > In article <cdrvjf$2md5$1@digitaldaemon.com>, Berin Loritsch says... > >>I agree. >> >>Foo!(int) >>Foo|(int) >>Foo:(int) >>Foo@(int) >>Foo#(int) >>Foo$(int) >> >>Out of the options listed, I think I like the pipe or colon declarator >>the best. > > > Well, would I be shot down in flames for suggesting this, rather obvious, > alternative: > > Foo<int> > > Arcane Jill No flames. But there's a good reason why D didn't go down this road. Using < and > for templates invites all kinds of parsing headaches (something about how < and > are already operators). It's Walter's compiler and he wanted to design it so that parsing is easy and fun. By the way, don't you miss the instance keyword? instance Foo(int) iFoo; Ah, the good old days... -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/ |
July 24, 2004 Re: Templates and the '!' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sha Chancellor | is there any reason it can't be just Foo(int) a; ? perhaps it has something to do with it looking a lot like a function. personally i think Foo!(int) looks like Foo *factorial* int. i was confused as hell when i updated D from 0.74 to 0.94 (i forgot about D for a while) when i saw all these List!(int) and what have you. |
July 24, 2004 Re: Templates and the '!' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote:
> is there any reason it can't be just
>
> Foo(int) a;
>
> ?
>
> perhaps it has something to do with it looking a lot like a function.
>
> personally i think Foo!(int) looks like Foo *factorial* int. i was confused
> as hell when i updated D from 0.74 to 0.94 (i forgot about D for a while)
> when i saw all these List!(int) and what have you.
>
>
Maybe the ! is an upside down i for instance? Hehe.
The colon looks natural but also looks like a label.
The string is unused so it would get my vote as an alternative.
Hmmmm arguing syntax and not semantics....flamewar approaching!
HEHEHE
|
Copyright © 1999-2021 by the D Language Foundation