D - D's template-synthax
- der_held (6/6) Feb 02 2004 D has a different template-synthax than all other C-like languages (e.g....
- davepermen (6/13) Feb 02 2004 and it was part of the evolution of D's templated that brought it to thi...
-
imr1984
(5/23)
Feb 02 2004
What do you mean "vector
> instead of vector >... - davepermen (11/39) Feb 02 2004 there's a space in the first one between the two >
-
der_held
(1/4)
Feb 02 2004
Java 1.5 can handle Foo
> without a whitespace between the two ... - davepermen (3/10) Feb 02 2004 does java 1.5 have an overloadable operator >> ?
- Matthias Becker (1/2) Feb 02 2004 Operators aren't overloadable, but there is a >> operator.
- Andy Friesen (9/17) Feb 02 2004 Right, but:
- Walter (9/16) Feb 09 2004 So could DMC++ at one point, but I had to take it out to pass the langua...
- davepermen (6/22) Feb 09 2004 it's still ugly to me.. it feels like a html-tag in c
- davepermen (11/37) Feb 09 2004 actually, the c++ language rules are very stoopid in that case.
-
Stewart Gordon
(15/20)
Feb 10 2004
- News auf Digitalmars.Com (11/32) Feb 10 2004 i know c++ is a parsing nightmare anyways. but fact is, you need to
- Walter (11/14) Feb 13 2004 The nice thing about the ! is it doesn't overload any other use of !, an...
- davepermen (42/58) Feb 13 2004 html has another issue.. redundancy. same for xml.
- Sean Kelly (5/10) Feb 13 2004 XML is painfully verbose, but it's not so bad otherwise. I think the
- davepermen (16/26) Feb 13 2004 dunno. i just don't like it at all. i hate the <> keys :D they look ugly...
- Sean Kelly (6/9) Feb 13 2004 Yup. Even with short tag names, 75% of the contents of an XML file is
- davepermen (4/13) Feb 15 2004 this doesn't make it bether. it's a bad fileformat..
- Derek Parnell (7/16) Feb 15 2004 Here is someone else's response to XML ...
- Sean Kelly (6/10) Feb 13 2004 hehe, I think it got that way because non-programmers were writing HTML
- Andy Friesen (5/12) Feb 13 2004 HTML would be better if it was Lisp. (not only is the syntax simpler
- Juanjo =?ISO-8859-15?Q?=C1lvarez?= (5/15) Feb 17 2004 I personally like the ! syntax because it reminds me of the Unix bang:
- Stewart Gordon (9/14) Feb 02 2004 Presumably because it interferes with context-free syntax.
- C (6/12) Feb 02 2004 I like the syntax , C++'s always seemed too wordy.
D has a different template-synthax than all other C-like languages (e.g. C++, looks a lot nicer: Foo<Bar> foo; vs. Foo!(Bar) foo;
Feb 02 2004
<> is ambiguous to parse.. thats why c++ needs to have vector<shared_ptr<T>instead of vector<shared_ptr<T>> for example.and it was part of the evolution of D's templated that brought it to this.. "der_held" <der_held_member pathlink.com> schrieb im Newsbeitrag news:bvl3cu$3do$1 digitaldaemon.com...D has a different template-synthax than all other C-like languages (e.g.C++,synthaxlooks a lot nicer: Foo<Bar> foo; vs. Foo!(Bar) foo;
Feb 02 2004
What do you mean "vector<shared_ptr<T>> instead of vector<shared_ptr<T>>" please explain. And I agree, the D template syntax does suck, the C++ way is so much nicer. Oh well the rest of the languagae is nice. Just my opinion. In article <bvl3j8$3su$1 digitaldaemon.com>, davepermen says...<> is ambiguous to parse.. thats why c++ needs to have vector<shared_ptr<T>instead of vector<shared_ptr<T>> for example.and it was part of the evolution of D's templated that brought it to this.. "der_held" <der_held_member pathlink.com> schrieb im Newsbeitrag news:bvl3cu$3do$1 digitaldaemon.com...D has a different template-synthax than all other C-like languages (e.g.C++,synthaxlooks a lot nicer: Foo<Bar> foo; vs. Foo!(Bar) foo;
Feb 02 2004
there's a space in the first one between the two > vector<shared_ptr<T> > works vector<shared_ptr<T>> not lets see if it works out in this post:D "imr1984" <imr1984_member pathlink.com> schrieb im Newsbeitrag news:bvl7rq$ahc$1 digitaldaemon.com...What do you mean "vector<shared_ptr<T>> instead of vector<shared_ptr<T>>"pleaseexplain. And I agree, the D template syntax does suck, the C++ way is so muchnicer. Ohwell the rest of the languagae is nice. Just my opinion. In article <bvl3j8$3su$1 digitaldaemon.com>, davepermen says...vector<shared_ptr<T><> is ambiguous to parse.. thats why c++ needs to havethis..instead of vector<shared_ptr<T>> for example.and it was part of the evolution of D's templated that brought it to(e.g."der_held" <der_held_member pathlink.com> schrieb im Newsbeitrag news:bvl3cu$3do$1 digitaldaemon.com...D has a different template-synthax than all other C-like languagesC++,synthaxlooks a lot nicer: Foo<Bar> foo; vs. Foo!(Bar) foo;
Feb 02 2004
there's a space in the first one between the two > vector<shared_ptr<T> > works vector<shared_ptr<T>> notJava 1.5 can handle Foo<Bar<Quer>> without a whitespace between the two >>.
Feb 02 2004
does java 1.5 have an overloadable operator >> ? "der_held" <der_held_member pathlink.com> schrieb im Newsbeitrag news:bvla8p$e6n$1 digitaldaemon.com...there's a space in the first one between the two > vector<shared_ptr<T> > works vector<shared_ptr<T>> notJava 1.5 can handle Foo<Bar<Quer>> without a whitespace between the two.
Feb 02 2004
does java 1.5 have an overloadable operator >> ?Operators aren't overloadable, but there is a >> operator.
Feb 02 2004
der_held wrote:Right, but: Foo<Bar> baz; looks like a template instantiation, right? What if Foo, Bar, and baz are integers? The meaning becomes TOTALLY different. One of the overt goals of D is to be parsable without being forced to do semantic analysis at the same time. You practically have to code an entire C++ compiler if you want to parse it right. -- andythere's a space in the first one between the two > vector<shared_ptr<T> > works vector<shared_ptr<T>> notJava 1.5 can handle Foo<Bar<Quer>> without a whitespace between the two >>.
Feb 02 2004
"der_held" <der_held_member pathlink.com> wrote in message news:bvla8p$e6n$1 digitaldaemon.com...So could DMC++ at one point, but I had to take it out to pass the language purity tests <g>. In any case, the foo!(t) parses cleanly with no special cases. foo<t> requires a lot of special case work in the parser, and even then one still winds up with funny rules for odd cases. As far as aesthetics goes, that depends on what you're used to. The < > was ugly to a lot of people when it first came out in C++, but people got accustomed to it over time.there's a space in the first one between the two > vector<shared_ptr<T> > works vector<shared_ptr<T>> notJava 1.5 can handle Foo<Bar<Quer>> without a whitespace between the two.
Feb 09 2004
it's still ugly to me.. it feels like a html-tag in c :D i hate html "Walter" <walter digitalmars.com> schrieb im Newsbeitrag news:c096si$1lbu$1 digitaldaemon.com..."der_held" <der_held_member pathlink.com> wrote in message news:bvla8p$e6n$1 digitaldaemon.com...aestheticsSo could DMC++ at one point, but I had to take it out to pass the language purity tests <g>. In any case, the foo!(t) parses cleanly with no special cases. foo<t> requires a lot of special case work in the parser, and even then one still winds up with funny rules for odd cases. As far asthere's a space in the first one between the two > vector<shared_ptr<T> > works vector<shared_ptr<T>> notJava 1.5 can handle Foo<Bar<Quer>> without a whitespace between the two.goes, that depends on what you're used to. The < > was ugly to a lot of people when it first came out in C++, but people got accustomed to it over time.
Feb 09 2004
actually, the c++ language rules are very stoopid in that case. you have to be able to specifically parse <Type> and <int> and such tokens after template tokens, but you are not allowed to specifically parse >>... thats utterly stupid, really. "davepermen" <davepermen hotmail.com> schrieb im Newsbeitrag news:c09vms$2slm$1 digitaldaemon.com...it's still ugly to me.. it feels like a html-tag in c :D i hate html "Walter" <walter digitalmars.com> schrieb im Newsbeitrag news:c096si$1lbu$1 digitaldaemon.com...two"der_held" <der_held_member pathlink.com> wrote in message news:bvla8p$e6n$1 digitaldaemon.com...there's a space in the first one between the two > vector<shared_ptr<T> > works vector<shared_ptr<T>> notJava 1.5 can handle Foo<Bar<Quer>> without a whitespace between thelanguageSo could DMC++ at one point, but I had to take it out to pass the.specialpurity tests <g>. In any case, the foo!(t) parses cleanly with noevencases. foo<t> requires a lot of special case work in the parser, andoverthen one still winds up with funny rules for odd cases. As far asaestheticsgoes, that depends on what you're used to. The < > was ugly to a lot of people when it first came out in C++, but people got accustomed to ittime.
Feb 09 2004
While it was 10/2/04 7:04 am throughout the UK, davepermen sprinkled little black dots on a white screen, and they fell thus:actually, the c++ language rules are very stoopid in that case. you have to be able to specifically parse <Type> and <int> and such tokens after template tokens, but you are not allowed to specifically parse >>... thats utterly stupid, really.<snip top of upside-down reply> You'd need to specifically _tokenise_ >> - a whole new concept. That is, unless you really want to explicitly define TempParams ::= TempParams ::= TempParams TempParam ',' TempInst ::= TempName '<' TempParams TempParam '>' TempInst ::= TempName '<' TempParams TempName '<' TempParams '>>' OK, so I'm not sure if this would be a parsing nightmare.... 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.
Feb 10 2004
i know c++ is a parsing nightmare anyways. but fact is, you need to spefically parse templates anyways. < and > have to be handled specially. why not >> then, too? first: Walter stated he has done this in dmc first, so it's definitely not impossible (and even for him, it felt logical to do it by default). second: other languages, that adopted it, are able to parse it, too. namely then again. what's the discussion about? we have D :D "Stewart Gordon" <smjg_1998 yahoo.com> schrieb im Newsbeitrag news:c0b050$1ha6$1 digitaldaemon.com...While it was 10/2/04 7:04 am throughout the UK, davepermen sprinkled little black dots on a white screen, and they fell thus:tokensactually, the c++ language rules are very stoopid in that case. you have to be able to specifically parse <Type> and <int> and suchafter template tokens, but you are not allowed to specifically parse ... thats utterly stupid, really.<snip top of upside-down reply> You'd need to specifically _tokenise_ >> - a whole new concept. That is, unless you really want to explicitly define TempParams ::= TempParams ::= TempParams TempParam ',' TempInst ::= TempName '<' TempParams TempParam '>' TempInst ::= TempName '<' TempParams TempName '<' TempParams '>>' OK, so I'm not sure if this would be a parsing nightmare.... 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.
Feb 10 2004
"davepermen" <davepermen hotmail.com> wrote in message news:c09vms$2slm$1 digitaldaemon.com...it's still ugly to me.. it feels like a html-tag in cThe nice thing about the ! is it doesn't overload any other use of !, and so it parses like a champ. I'm a bit surprised ! wasn't used as a binary operator long before. Easy to parse also means things like color syntax highlighting are going to work right without having to build a C++ compiler into the editor.:D i hate htmlLOL. I like HTML's predecessor, RUNOFF, which used dot commands. HTML's main problem is it is so poorly defined (I found 3 different definitions of what a comment in HTML was), that different interpretations of it have produced a bit of a mess.
Feb 13 2004
html has another issue.. redundancy. same for xml. xml is espencially stupid, because it tries to have "one unified solution to a specific data representation", while it provides at least 3 for the same data. <tag></tag> is equal to <tag /> <tag a="." /> is equal to <tag a="."></tag> and technically can be done with <tag><a>.</a></tag> as well instead of xml, i prefer this own one: html( head( title("Title of Page") ) body( bgcolour("black") font( colour("white") ) h1("Hello on my Page") p("lele.. not much in here yet") ) ) or.. window( title("Sure you want to overwrite?") button(text("OK") default("true")) button(text("Cancel") escape("true")) ) <tag></tag> is stupid. tag() works much nicer, and shorter:D (and can, if you add the proper ',' in between, directly get parsed as code, with function calls in:D) "Walter" <walter digitalmars.com> schrieb im Newsbeitrag news:c0itgs$2d6f$1 digitaldaemon.com..."davepermen" <davepermen hotmail.com> wrote in message news:c09vms$2slm$1 digitaldaemon.com...soit's still ugly to me.. it feels like a html-tag in cThe nice thing about the ! is it doesn't overload any other use of !, andit parses like a champ. I'm a bit surprised ! wasn't used as a binary operator long before. Easy to parse also means things like color syntax highlighting are going to work right without having to build a C++compilerinto the editor.main:D i hate htmlLOL. I like HTML's predecessor, RUNOFF, which used dot commands. HTML'sproblem is it is so poorly defined (I found 3 different definitions ofwhata comment in HTML was), that different interpretations of it have producedabit of a mess.
Feb 13 2004
davepermen wrote:html has another issue.. redundancy. same for xml. xml is espencially stupid, because it tries to have "one unified solution to a specific data representation", while it provides at least 3 for the same data.XML is painfully verbose, but it's not so bad otherwise. I think the attribute vs. contained element distinction is useful for separating identity data from other data. Sean
Feb 13 2004
dunno. i just don't like it at all. i hate the <> keys :D they look ugly. xml looks ugly.. and most the time, if you look at xml, most part of the file are not data, but xml tag names, and such, filling the whole with useless stuff.. lisp as data format would be great:D with some simple regexp style definition on how the document has to look *(window ?(title) *(window)) means a window can contain 0 or 1 title, and several windows and then the code, again:D something like that could be done.. i would prefer it by much.. and when i see xaml being the future, then i think wow, it's a very cool idea, but urgh, xaml files look UGLY! and i fear:D "Sean Kelly" <sean ffwd.cx> schrieb im Newsbeitrag news:c0j5el$2q5t$1 digitaldaemon.com...davepermen wrote:solution tohtml has another issue.. redundancy. same for xml. xml is espencially stupid, because it tries to have "one unifiedsamea specific data representation", while it provides at least 3 for thedata.XML is painfully verbose, but it's not so bad otherwise. I think the attribute vs. contained element distinction is useful for separating identity data from other data. Sean
Feb 13 2004
davepermen wrote:and most the time, if you look at xml, most part of the file are not data, but xml tag names, and such, filling the whole with useless stuff..Yup. Even with short tag names, 75% of the contents of an XML file is probably descriptive data :) Luckily, you almost never have to actually look at the file, just parse them directly from code. Sean
Feb 13 2004
this doesn't make it bether. it's a bad fileformat.. "Sean Kelly" <sean ffwd.cx> schrieb im Newsbeitrag news:c0jj51$eip$1 digitaldaemon.com...davepermen wrote:data,and most the time, if you look at xml, most part of the file are notbut xml tag names, and such, filling the whole with useless stuff..Yup. Even with short tag names, 75% of the contents of an XML file is probably descriptive data :) Luckily, you almost never have to actually look at the file, just parse them directly from code. Sean
Feb 15 2004
On Fri, 13 Feb 2004 14:29:52 -0800 (02/14/04 09:29:52) , Sean Kelly <sean ffwd.cx> wrote:davepermen wrote:Here is someone else's response to XML ... http://users.pandora.be/tommycarlier/smel/index.htm Its trying to be a less-verbose alternative. -- Derekand most the time, if you look at xml, most part of the file are not data, but xml tag names, and such, filling the whole with useless stuff..Yup. Even with short tag names, 75% of the contents of an XML file is probably descriptive data :) Luckily, you almost never have to actually look at the file, just parse them directly from code.
Feb 15 2004
Walter wrote:LOL. I like HTML's predecessor, RUNOFF, which used dot commands. HTML's main problem is it is so poorly defined (I found 3 different definitions of what a comment in HTML was), that different interpretations of it have produced a bit of a mess.hehe, I think it got that way because non-programmers were writing HTML and constantly screwing up but rather than tell them to learn the language they modified it to suit them. This was definately the case with paragraph tags. Sean
Feb 13 2004
Walter wrote:HTML would be better if it was Lisp. (not only is the syntax simpler and easier to parse, but you obliviate any distinction between content and 'client side scripting') -- andyi hate htmlLOL. I like HTML's predecessor, RUNOFF, which used dot commands. HTML's main problem is it is so poorly defined (I found 3 different definitions of what a comment in HTML was), that different interpretations of it have produced a bit of a mess.
Feb 13 2004
I personally like the ! syntax because it reminds me of the Unix bang: "Use bash to run this". D: TFoo!(int): Use int to run this template. Walter wrote:"davepermen" <davepermen hotmail.com> wrote in message news:c09vms$2slm$1 digitaldaemon.com...it's still ugly to me.. it feels like a html-tag in cThe nice thing about the ! is it doesn't overload any other use of !, and so it parses like a champ. I'm a bit surprised ! wasn't used as a binary operator long before. Easy to parse also means things like color syntax highlighting are going to work right without having to build a C++ compiler into the editor.
Feb 17 2004
While it was 2/2/04 8:57 am throughout the UK, der_held sprinkled little black dots on a white screen, and they fell thus:D has a different template-synthax than all other C-like languages (e.g. C++, looks a lot nicer: Foo<Bar> foo;Presumably because it interferes with context-free syntax. (Foo less than bar) greater than foo.... 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.
Feb 02 2004
I like the syntax , C++'s always seemed too wordy. C "der_held" <der_held_member pathlink.com> wrote in message news:bvl3cu$3do$1 digitaldaemon.com...D has a different template-synthax than all other C-like languages (e.g.C++,synthaxlooks a lot nicer: Foo<Bar> foo; vs. Foo!(Bar) foo;
Feb 02 2004