digitalmars.D - Templates and the '!'
- Sha Chancellor (8/8) Jul 23 2004 I just was looking at a piece of code. And while this is largely my
- Berin Loritsch (11/23) Jul 23 2004 I agree.
- Daniel Horn (4/32) Jul 23 2004 you've corrupted me!(Human)
- Arcane Jill (5/14) Jul 23 2004 Well, would I be shot down in flames for suggesting this, rather obvious...
- Sean Kelly (8/24) Jul 23 2004 hehe... As for the previous suggestions, the colon is used as a label sp...
- Andrew Edwards (4/36) Jul 23 2004 I have to agree with Sean here. ! seems completely natural to me. Then
- Sha Chancellor (3/37) Jul 23 2004 I think I like the $ as the best alternative also. :P
- Walter (4/6) Jul 25 2004 Yeah, but you'd run afoul of all those folks who want to use $ as a syno...
- Stewart Gordon (9/18) Jul 26 2004 Maybe we should show some international awareness....
- C. Sauls (5/7) Jul 26 2004 While we're at it, let me propose
- Arcane Jill (13/17) Jul 26 2004 I realise you were joking. (I noticed the smiley!). But in general we sh...
- Stewart Gordon (10/19) Jul 26 2004 I realise you realise I was joking. (I noticed the acknowledgement of
- J C Calvarese (11/32) Jul 23 2004 No flames. But there's a good reason why D didn't go down this road.
-
Arcane Jill
(3/8)
Jul 26 2004
Hmmm. Then I think Walter should stop writing
in his emails. - Berin Loritsch (2/17) Jul 26 2004 Great one! ROTFLOL
-
h3r3tic
(3/25)
Jul 26 2004
Or just at least use
to be compatible with XHTML and not spreading... - John Reimer (3/8) Jul 27 2004 That actually was pretty funny... :-)
- Berin Loritsch (3/16) Jul 27 2004 In netspeak it is supposed to be a synonym for "grin", or basically
- John Reimer (2/7) Jul 27 2004 Yes, I realize that. That was just my weak attempt at extending the jok...
- Elephant (8/33) Jul 23 2004 Pipe is logical OR no ? , colon is label specifier, the others are ugly,...
- Sha Chancellor (2/9) Jul 23 2004 This isn't perl-land. # is not a comment, and $ is not a scalar. and ...
- Walter (5/11) Jul 25 2004 These have parsing ambiguity problems.
- h3r3tic (4/5) Jul 25 2004 Sorry, but what's the reason ? D is a new language, it's not meant to be
- Mike Parker (4/6) Jul 26 2004 Ah, but it is meant to be compatible with C at the binary level and, to
- h3r3tic (11/21) Jul 26 2004 Yet I dont think that foo!(int) is a small deviation from the C syntax.
- Berin Loritsch (12/22) Jul 26 2004 Yes, but the D templating feature is a complete deviation from
- Matthias Becker (8/10) Jul 26 2004 Nope. We wrote a preprocessor for C++ to do just that!
- Jarrett Billingsley (7/7) Jul 23 2004 is there any reason it can't be just
- David Medlock (6/19) Jul 23 2004 Maybe the ! is an upside down i for instance? Hehe.
- C. Sauls (6/8) Jul 23 2004 Actually, # is used for Special Token Sequences:
- Derek (16/28) Jul 23 2004 Okay, I'll bite too! I still have a mental hiccup when seeing all those ...
- Charles Hixson (12/24) Jul 25 2004 OK. Well, how about:
- Matthias Becker (1/3) Jul 26 2004 € isn't used either. I think $ is a pretty stupid symbol.
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
Jul 23 2004
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 | orI agree. 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.
Jul 23 2004
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 | orI agree. 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.
Jul 23 2004
In article <cdrvjf$2md5$1 digitaldaemon.com>, Berin Loritsch says...I agree. 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
Jul 23 2004
In article <cds3re$2qcl$1 digitaldaemon.com>, Arcane Jill says...In article <cdrvjf$2md5$1 digitaldaemon.com>, Berin Loritsch says...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 "$" SeanI agree. 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>
Jul 23 2004
Sean Kelly wrote:In article <cds3re$2qcl$1 digitaldaemon.com>, Arcane Jill says...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".In article <cdrvjf$2md5$1 digitaldaemon.com>, Berin Loritsch says...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 "$" SeanI agree. 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>
Jul 23 2004
In article <cds80e$2u3d$1 digitaldaemon.com>, Andrew Edwards says...Sean Kelly wrote:I think I like the $ as the best alternative also. :P Foo$(int) looks good to me.In article <cds3re$2qcl$1 digitaldaemon.com>, Arcane Jill says...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".In article <cdrvjf$2md5$1 digitaldaemon.com>, Berin Loritsch says...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 "$" SeanI agree. 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>
Jul 23 2004
"Sha Chancellor" <schancel pacific.net> wrote in message news:cds920$2us1$1 digitaldaemon.com...I think I like the $ as the best alternative also. :P Foo$(int) looks good to me.Yeah, but you'd run afoul of all those folks who want to use $ as a synonym for array.length <g>.
Jul 25 2004
Walter wrote:"Sha Chancellor" <schancel pacific.net> wrote in message news:cds920$2us1$1 digitaldaemon.com...Maybe we should show some international awareness.... FooŁ(int) :-) Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.I think I like the $ as the best alternative also. :P Foo$(int) looks good to me.Yeah, but you'd run afoul of all those folks who want to use $ as a synonym for array.length <g>.
Jul 26 2004
Stewart Gordon wrote:Maybe we should show some international awareness.... Foo£(int)While we're at it, let me propose Foo如(int) -Chris S. -Invironz
Jul 26 2004
In article <ce2naq$oi2$3 digitaldaemon.com>, Stewart Gordon says...Maybe we should show some international awareness.... FooŁ(int) :-) Stewart.I realise you were joking. (I noticed the smiley!). But in general we should all be aware that this sort of thing is not possible. From the D manual: D source text can be in one of the following formats: * ASCII * UTF-8 * UTF-16BE * UTF-16LE * UTF-32BE * UTF-32LE You'd have to cross ASCII off that list if we were to allow non-ASCII characters in required syntax. Jill
Jul 26 2004
Arcane Jill wrote:In article <ce2naq$oi2$3 digitaldaemon.com>, Stewart Gordon says...<snip>Maybe we should show some international awareness.... FooŁ(int) :-)You'd have to cross ASCII off that list if we were to allow non-ASCII characters in required syntax.I realise you realise I was joking. (I noticed the acknowledgement of the smiley!) But a module isn't required to instantiate templates for it to be a valid D module. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Jul 26 2004
Arcane Jill wrote:In article <cdrvjf$2md5$1 digitaldaemon.com>, Berin Loritsch says...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/I agree. 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
Jul 23 2004
In article <cdsb9n$30ne$1 digitaldaemon.com>, J C Calvarese says...Foo<int>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.Hmmm. Then I think Walter should stop writing <g> in his emails. Jill !(g)
Jul 26 2004
Arcane Jill wrote:In article <cdsb9n$30ne$1 digitaldaemon.com>, J C Calvarese says...Great one! ROTFLOLFoo<int>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.Hmmm. Then I think Walter should stop writing <g> in his emails. Jill !(g)
Jul 26 2004
Berin Loritsch wrote:Arcane Jill wrote:Or just at least use <g /> to be compatible with XHTML and not spreading that old HTML bullshitIn article <cdsb9n$30ne$1 digitaldaemon.com>, J C Calvarese says...Great one! ROTFLOLFoo<int>But there's a good reason why D didn't go down this road. Using < andHmmm. Then I think Walter should stop writing <g> in his emails. Jill !(g)for templates invites all kinds of parsing headaches (somethingabout how < and > are already operators). It's Walter's compiler and he wanted to design it so that parsing is easy and fun.
Jul 26 2004
On Mon, 26 Jul 2004 11:24:33 -0400, Berin Loritsch wrote:That actually was pretty funny... :-) Does that mean the 'g' stands for "generic," then?Hmmm. Then I think Walter should stop writing <g> in his emails. Jill !(g)Great one! ROTFLOL
Jul 27 2004
John Reimer wrote:On Mon, 26 Jul 2004 11:24:33 -0400, Berin Loritsch wrote:In netspeak it is supposed to be a synonym for "grin", or basically don't take the comment too seriously.That actually was pretty funny... :-) Does that mean the 'g' stands for "generic," then?Hmmm. Then I think Walter should stop writing <g> in his emails. Jill !(g)Great one! ROTFLOL
Jul 27 2004
On Tue, 27 Jul 2004 17:18:31 -0400, Berin Loritsch wrote:Yes, I realize that. That was just my weak attempt at extending the joke. :-(Does that mean the 'g' stands for "generic," then?In netspeak it is supposed to be a synonym for "grin", or basically don't take the comment too seriously.
Jul 27 2004
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) 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 JillWell, would I be shot down in flames for suggesting this, rather obvious, alternative:Booo!!! Booooooooooo!!!Pipe is logical OR no ? , colon is label specifier, the others are ugly, i personally like the !. $ <- scalar <- array Purple ElephantFoo!(int) Foo|(int) Foo:(int) Foo (int) Foo$(int)
Jul 23 2004
just for email addresses. :PPipe is logical OR no ? , colon is label specifier, the others are ugly, i personally like the !. $ <- scalar <- array Purple Elephant
Jul 23 2004
"Berin Loritsch" <bloritsch d-haven.org> wrote in message news:cdrvjf$2md5$1 digitaldaemon.com...Foo|(int) Foo:(int)These have parsing ambiguity problems.Foo (int) Foo$(int)I try to avoid using characters not in the C set.The "!" symbol just naturally maps to "not" in many people's minds."*" piped to multiply in my mind before I started using C <g>.
Jul 25 2004
I try to avoid using characters not in the C set.Sorry, but what's the reason ? D is a new language, it's not meant to be compatible with C or C++. Why then restrict to that 30 year old standard ? OT: If I were making up the syntax, I'd make it use Python-like indentation instead of curly braces but that's just the broken CPU in my head ;)
Jul 25 2004
h3r3tic wrote:Sorry, but what's the reason ? D is a new language, it's not meant to be compatible with C or C++. Why then restrict to that 30 year old standard ?Ah, but it is meant to be compatible with C at the binary level and, to a lesser extent, at the syntax level. The less you deviate from traditional C syntax the easier it is to learn the language.
Jul 26 2004
Mike Parker wrote:h3r3tic wrote:Yet I dont think that foo!(int) is a small deviation from the C syntax. It will seem to C programmers as foo not int. Making it foo (int) for instance (heh, instance...) would make them think "aaaahh, that's something different!" and reading foo at int, pretty much seems logical as a template specialization. AT reads as SPECIALIZED BY in my mind. But again, I don't think I can make anyone/Walter change the current syntax. Yet I still think that if someone is smart enough to learn C, they would be smart enough to learn some syntax changes. Anyway, I hope we'll have implicit specializations so I don't have to use foo!(int) too oftenSorry, but what's the reason ? D is a new language, it's not meant to be compatible with C or C++. Why then restrict to that 30 year old standard ?Ah, but it is meant to be compatible with C at the binary level and, to a lesser extent, at the syntax level. The less you deviate from traditional C syntax the easier it is to learn the language.
Jul 26 2004
Mike Parker wrote:h3r3tic wrote:Yes, but the D templating feature is a complete deviation from already. So either use that notation, or if it makes sense, finish the job and use a character not in use in the C language already. WOT: Someone I know and respect (having been in the computing industry for a long time) seriously believes that the creators of C (and Unix) did it as a practical joke. "Why not make things as obtuse as possible?" In the process of making it obtuse, it was also very powerful, and caught on like wildfire (better than using COBOL or assembly for cross platform work). I don't have anything to support his claims, but it is just crazy enough to have some truth to it :)Sorry, but what's the reason ? D is a new language, it's not meant to be compatible with C or C++. Why then restrict to that 30 year old standard ?Ah, but it is meant to be compatible with C at the binary level and, to a lesser extent, at the syntax level. The less you deviate from traditional C syntax the easier it is to learn the language.
Jul 26 2004
OT: If I were making up the syntax, I'd make it use Python-like indentation instead of curly braces but that's just the broken CPU in my head ;)Nope. We wrote a preprocessor for C++ to do just that! int main () cout << "Hello, World\n" way cooler then int main () { cout << "Hello, World\n" }
Jul 26 2004
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.
Jul 23 2004
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
Jul 23 2004
Sha Chancellor wrote:Why are we using the ! symbol for templates? Couldn't we use a | orhttp://www.digitalmars.com/d/lex.html#specialtokens I'm happy with ! but if it were changed, I'd vote for $ above all. -Chris S. -Invironz
Jul 23 2004
On Fri, 23 Jul 2004 14:03:21 -0700, 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 | orOkay, I'll bite too! I still have a mental hiccup when seeing all those '!' symbols embedded inside template instances. Foo(int) is my preference. The ' ' signifying that the next token 'Foo' is a template name and the template is now being instantiated, using 'int' as its argument. However, I haven't been able to grok the whole D template system. Every thime I read the docs and examples, I come away even more confused. I've tried a few times to play with them but it still does not make any sense to me. I guess I'm not sure what problems are trying to be solved by them. But I haven't given up yet. ;-) -- Derek Melbourne, Australia
Jul 23 2004
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 | orOK. Well, how about: Foo!!(int) Or even (sorry Walter) Foo!int! I suppose I'm getting too Eiffelish here, and Walter doesn't like separated markers. So I propose The operator should be !! It's name should be _instance_ (just in case we ever want to allow it to be overridden). Spaces before and after it should be optional. So, probably, should be the parens. A type argument is required.
Jul 25 2004
Why are we using the ! symbol for templates? Couldn't we use a | or€ isn't used either. I think $ is a pretty stupid symbol.
Jul 26 2004