D - dmd 0.37 release - operator overloading
- Walter (4/4) Aug 18 2002 ftp://www.digitalmars.com/dmdalpha.zip
- anderson (3/7) Aug 19 2002 Great Job!
- Walter (4/16) Aug 19 2002 The neat thing is it turned out to be an amazingly small amount of code
- anderson (9/13) Aug 19 2002 I don't understand point 4.
- Russ Lewis (9/27) Aug 19 2002 I believe that 4 is a fall-through if options 1-3 fail. If you've tried...
- Walter (5/8) Aug 19 2002 to
- Russ Lewis (11/15) Aug 19 2002 Very good! Now, on to the op= operators...since they are often much
- Jonathan Andrew (4/8) Aug 19 2002 I don't think it gets much simpler than that. I agree with anderson,
- Walter (4/6) Aug 19 2002 Thanks! I've sinced added a blurb to www.digitalmars.com/d/cpptod.html t...
- Sean L. Palmer (7/11) Aug 19 2002 What happened to the nice Vector operator (Vector a) + (Vector b) {} syn...
- Walter (10/15) Aug 19 2002 syntax
- Sean L. Palmer (8/23) Aug 19 2002 It'll do. ;)
- Walter (3/5) Aug 20 2002 ok, ok!
- Pavel Minayev (5/9) Aug 20 2002 Grab it!
- Pavel Minayev (0/0) Aug 20 2002
- Joe Battelle (3/3) Aug 19 2002 "where a is a class or struct object reference..."
- Walter (4/7) Aug 19 2002 well?
- Joe Battelle (2/3) Aug 19 2002 Just for operator members or have you added methods to structs in the ge...
- Pavel Minayev (3/5) Aug 19 2002 They were added loooong ago.
- Joe Battelle (4/5) Aug 19 2002 Sorry about that, I kept reading this line from the Structs documentatio...
- Pavel Minayev (27/27) Aug 19 2002 On Sun=2C 18 Aug 2002 23=3A53=3A48 -0700 =22Walter=22 =3Cwalter=40digita...
- Walter (14/17) Aug 19 2002 does its job well! Now, as soon as we get all operators (by the way,
- Pavel Minayev (2/5) Aug 20 2002 Alternative? Unless you give us safe varargs, of course... =)
- Walter (7/12) Aug 20 2002 wrote:
- Alix Pexton (17/25) Aug 21 2002 I always thought it would be nice to specify varargs with simple
- Carlos (8/22) Aug 21 2002 Hi all...
-
Walter
(6/13)
Aug 21 2002
Ah, the ghost of postings past
. - Carlos (2/5) Aug 21 2002 Ok, but I mainly meant about the other stuff... About using other symbol...
- Walter (4/6) Aug 22 2002 as
- Sean L. Palmer (8/15) Aug 22 2002 I want to use Unicode math symbols as operators ;) Dot and cross produc...
- Walter (4/7) Aug 22 2002 I've been thinking that it might be possible to predefine some of those ...
- Juan Carlos Arevalo Baeza (5/8) Aug 22 2002 What text editor would you use to program, then? Ahem...
- Pavel Minayev (3/4) Aug 22 2002 BeOS StyleEdit. Or QNX Ped. Or maybe just FAR. =)
- Sean L. Palmer (11/19) Aug 23 2002 That's a good question, and I don't have a good answer. But I do find i...
- Walter (6/12) Aug 23 2002 long
- Juan Carlos Arevalo Baeza (10/13) Aug 23 2002 ME
- Walter (6/17) Aug 23 2002 system
- Sean L. Palmer (6/25) Aug 24 2002 Just cut'n'paste from the Character Map tool.
- Pavel Minayev (3/4) Aug 24 2002 Conclusion: any D IDE should support Unicode.
- Pavel Minayev (8/10) Aug 24 2002 There are different keyboard mappings, and many OSes allow you to create...
- Carlos (6/9) Aug 22 2002 You can call me crazy (actually, you'd be right if you do that ;) ), but...
ftp://www.digitalmars.com/dmdalpha.zip www.digitalmars.com/d/operatoroverloading.html It doesn't do all the operators yet, but it's a start. -Walter
Aug 18 2002
Great Job! "Walter" <walter digitalmars.com> wrote in message news:ajq4fo$311i$1 digitaldaemon.com...ftp://www.digitalmars.com/dmdalpha.zip www.digitalmars.com/d/operatoroverloading.html It doesn't do all the operators yet, but it's a start. -Walter
Aug 19 2002
The neat thing is it turned out to be an amazingly small amount of code added to the source. -Walter "anderson" <anderson firestar.com.au> wrote in message news:ajqtvc$rg0$1 digitaldaemon.com...Great Job! "Walter" <walter digitalmars.com> wrote in message news:ajq4fo$311i$1 digitaldaemon.com...ftp://www.digitalmars.com/dmdalpha.zip www.digitalmars.com/d/operatoroverloading.html It doesn't do all the operators yet, but it's a start. -Walter
Aug 19 2002
I don't understand point 4. "4. If a or b is a struct or class object reference, it is an error. " Do you mean? "4. If a and b is a struct or class object reference, it is an error. " If so do you plan on making class by class operations overloadable in a future? Can you add an example for 4.? "Walter" <walter digitalmars.com> wrote in message news:ajq4fo$311i$1 digitaldaemon.com...ftp://www.digitalmars.com/dmdalpha.zip www.digitalmars.com/d/operatoroverloading.html It doesn't do all the operators yet, but it's a start. -Walter
Aug 19 2002
I believe that 4 is a fall-through if options 1-3 fail. If you've tried to use an operator, and the classes offer no way to relate them, then it is an error. anderson wrote:I don't understand point 4. "4. If a or b is a struct or class object reference, it is an error. " Do you mean? "4. If a and b is a struct or class object reference, it is an error. " If so do you plan on making class by class operations overloadable in a future? Can you add an example for 4.? "Walter" <walter digitalmars.com> wrote in message news:ajq4fo$311i$1 digitaldaemon.com...-- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]ftp://www.digitalmars.com/dmdalpha.zip www.digitalmars.com/d/operatoroverloading.html It doesn't do all the operators yet, but it's a start. -Walter
Aug 19 2002
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3D611181.FE5B9F74 deming-os.org...I believe that 4 is a fall-through if options 1-3 fail. If you've triedtouse an operator, and the classes offer no way to relate them, then it isanerror.That's right.
Aug 19 2002
Very good! Now, on to the op= operators...since they are often much faster and memory efficient to implement :) In fact, in my mathematical classes in C++, I would often implement op as derived from op= . I would create a temporary copy of an object, use the op= function on that, and then return the temporary... Walter wrote:ftp://www.digitalmars.com/dmdalpha.zip www.digitalmars.com/d/operatoroverloading.html It doesn't do all the operators yet, but it's a start. -Walter-- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
Aug 19 2002
Walter wrote:ftp://www.digitalmars.com/dmdalpha.zip www.digitalmars.com/d/operatoroverloading.html It doesn't do all the operators yet, but it's a start. -WalterI don't think it gets much simpler than that. I agree with anderson, good job! -Jon
Aug 19 2002
"Jonathan Andrew" <jon ece.arizona.edu> wrote in message news:3D611674.3D0C2921 ece.arizona.edu...I don't think it gets much simpler than that. I agree with anderson, good job!Thanks! I've sinced added a blurb to www.digitalmars.com/d/cpptod.html to highlight the difference between the D way and the C++ way.
Aug 19 2002
What happened to the nice Vector operator (Vector a) + (Vector b) {} syntax everyone was voting for? You figured out a way around the friend problem. Some things just don't properly belong in either class and should be sorta global. Sean "Walter" <walter digitalmars.com> wrote in message news:ajq4fo$311i$1 digitaldaemon.com...ftp://www.digitalmars.com/dmdalpha.zip www.digitalmars.com/d/operatoroverloading.html It doesn't do all the operators yet, but it's a start. -Walter
Aug 19 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ajr7iv$1ddn$1 digitaldaemon.com...What happened to the nice Vector operator (Vector a) + (Vector b) {}syntaxeveryone was voting for?I believe that adds significant complexity to the language, whereas the naming convention route offers equivalent power (or even more power, as the functions can be virtual, variadic, etc.) very simply.You figured out a way around the friend problem.Yes, that one had me stumped for a while.Some things just don't properly belong in either class and should be sorta global.I agree, but since the desired result can be adequately addressed with the member syntax, I thought adding more syntax for global functions was not worth the cost.
Aug 19 2002
It'll do. ;) Now if I can just get a windows.d that has GetFocus() and PeekMessage() in it... I'll be in business! Sean "Walter" <walter digitalmars.com> wrote in message news:ajrat2$1kdf$1 digitaldaemon.com..."Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ajr7iv$1ddn$1 digitaldaemon.com...theWhat happened to the nice Vector operator (Vector a) + (Vector b) {}syntaxeveryone was voting for?I believe that adds significant complexity to the language, whereas the naming convention route offers equivalent power (or even more power, asfunctions can be virtual, variadic, etc.) very simply.sortaYou figured out a way around the friend problem.Yes, that one had me stumped for a while.Some things just don't properly belong in either class and should beglobal.I agree, but since the desired result can be adequately addressed with the member syntax, I thought adding more syntax for global functions was not worth the cost.
Aug 19 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ajsoge$7sn$1 digitaldaemon.com...Now if I can just get a windows.d that has GetFocus() and PeekMessage() in it... I'll be in business!ok, ok!
Aug 20 2002
On Mon, 19 Aug 2002 23:52:52 -0700 "Sean L. Palmer" <seanpalmer earthlink.net> wrote:It'll do. ;) Now if I can just get a windows.d that has GetFocus() and PeekMessage() in it... I'll be in business!Grab it! This is the latest version used by WinD, and it's hand-coded (unlike my old windows.d). I hope that Walter will merge it with his API declarations.
Aug 20 2002
"where a is a class or struct object reference..." Did I miss something or are we getting concrete types (in C++ parlance) as well? All the examples show class and not struct so--maybe not yet?
Aug 19 2002
"Joe Battelle" <Joe_member pathlink.com> wrote in message news:ajr888$1eqp$1 digitaldaemon.com..."where a is a class or struct object reference..." Did I miss something or are we getting concrete types (in C++ parlance) aswell?All the examples show class and not struct so--maybe not yet?The struct overloading is implemented.
Aug 19 2002
The struct overloading is implemented.Just for operator members or have you added methods to structs in the general case?
Aug 19 2002
On Mon, 19 Aug 2002 18:19:03 +0000 (UTC) Joe Battelle <Joe_member pathlink.com> wrote:Just for operator members or have you added methods to structs in the general case?They were added loooong ago.
Aug 19 2002
They were added loooong ago.Sorry about that, I kept reading this line from the Structs documentation: "Member functions and static members are allowed." as though it had a _not_ in it. Weird, there's a not right above it--maybe my brain grabbed on to that one :)
Aug 19 2002
On Sun=2C 18 Aug 2002 23=3A53=3A48 -0700 =22Walter=22 =3Cwalter=40digitalmars=2Ecom=3E wrote=3A =3E ftp=3A=2F=2Fwww=2Edigitalmars=2Ecom=2Fdmdalpha=2Ezip =3E =3E www=2Edigitalmars=2Ecom=2Fd=2Foperatoroverloading=2Ehtml =3E =3E It doesn't do all the operators yet=2C but it's a start=2E Great=2E Not the syntax I was expecting=2C frankly=2C but hey - it works=2C and does its job well! Now=2C as soon as we get all operators =28by the way=2C will binary ~ and ~=3D be supported=3F I hope so!=29=2C only templates would be left of important C++ functionality not covered by D=2E=2E=2E By the way=2E=2E=2E I proposed this once before=2C but back then=2C operator overloading wasn't implemented=2E What about input and output operators=2C for example -=3E and =3C-=2C to use them for streams and alike where C++ overloads =3E=3E and =3C=3C=2E They wouldn't be allowed on global types=2C so you'd have to overload them=2E But it could be useful=3A =09int main=28=29 =09{ =09=09char=5B=5D name=3B =09=09cout =3C- =22Enter your name=3A =22=3B =09=09cin -=3E name=3B =09=09cout =3C- =22Hello=2C =22 =3C- name =3C- =22!=5Cn=22=3B =09=09return 0=3B =09} Well=2C you get the idea=2E It could also be some other operator=2C care really=2C it would be just great if there was some better way to output data then printf=28=29=2E
Aug 19 2002
"Pavel Minayev" <evilone omen.ru> wrote in message news:CFN374879772193056 news.digitalmars.com...Great. Not the syntax I was expecting, frankly, but hey - it works, anddoes its job well! Now, as soon as we get all operators (by the way, will binary ~ and ~= be supported? I hope so!), Yes, I just forgot them for the moment.only templates would be left of important C++ functionality not covered byD... With a much simpler language!By the way... I proposed this once before, but back then, operatoroverloading wasn't implemented. What about input and output operators, for example -> and <-, to use them for streams and alike where C++ overloads >> and <<. They wouldn't be allowed on global types, so you'd have to overload them. But it could be useful: I confess I just never liked the idea behind iostreams and the overloaded operators for it. It just never looked right or elegant. It also always seemed to result in fat exe's.
Aug 19 2002
On Mon, 19 Aug 2002 16:16:11 -0700 "Walter" <walter digitalmars.com> wrote:I confess I just never liked the idea behind iostreams and the overloaded operators for it. It just never looked right or elegant. It also always seemed to result in fat exe's.Alternative? Unless you give us safe varargs, of course... =)
Aug 20 2002
"Pavel Minayev" <evilone omen.ru> wrote in message news:CFN374884942340972 news.digitalmars.com...On Mon, 19 Aug 2002 16:16:11 -0700 "Walter" <walter digitalmars.com>wrote:overloadedI confess I just never liked the idea behind iostreams and theMy grand idea is mumble - mumble - mumble, and so you see, it is brilliant! But seriously, at the moment I'm working on the generics issue. I hope to have a strawman for that by the end of the month. -Walteroperators for it. It just never looked right or elegant. It also always seemed to result in fat exe's.Alternative? Unless you give us safe varargs, of course... =)
Aug 20 2002
I always thought it would be nice to specify varargs with simple regular(ish) expressions, something similar to the syntax used in a DTD would be sufficient. The only problem with a direct lift is the * Then all you have to do is have a way of correctly reading the arguments regardless of how the expression is matched. That I'd leave up to you (points wildly in random, generally leftward direction)... -- Alix Pexton... Webmaster, The D Journal web: www.thedjournal.com email:webmaster thedjournal.com "The D journal, a work in progress..." Pavel Minayev <evilone omen.ru> wrote in article <CFN374884942340972 news.digitalmars.com>...On Mon, 19 Aug 2002 16:16:11 -0700 "Walter" <walter digitalmars.com>wrote:overloadedI confess I just never liked the idea behind iostreams and theoperators for it. It just never looked right or elegant. It also always seemed to result in fat exe's.Alternative? Unless you give us safe varargs, of course... =)
Aug 21 2002
Hi all... Outlook Express did a weird thing and started to download ALL the messages in this newsgroup (I stopped before it was finished), but it was good because I found this post, which dates 2001-08-17. Not many of us were in this newsgroup in that time, so probably most won't know of its existence (and also, many of those who used to post back then don't post now). Well... What do you guys (Walter especially) think about it? Walter wrote:Charles Hixson wrote in message <3B7D2C6B.4040702 earthlink.net>......So one could define :+: to add matrices, etc., and as these would really be functions, they should follow the normal overloading rules of functions. This would allow them to be easily parsed, would distinguish them clearly from the standard operators, and would provide the majority of the notational compactness that normal operators provide. The fact that A :+: B would be syntactic sugar for A.add (B) is minor, but convenient. As to precedence ... they should probably bind more strongly than any other operator, and all to the same degree. If you want to get fancy, you'ld need to use parentheses.Now this idea has a lot of merit! Thanks for posting it. I *like* it being clearly distinguishable from the native operators.
Aug 21 2002
"Carlos" <carlos8294 msn.com> wrote in message news:ak1n98$utk$1 digitaldaemon.com...Hi all... Outlook Express did a weird thing and started to download ALL the messages in this newsgroup (I stopped before it was finished), but it was good because I found this post, which dates 2001-08-17. Not many of us were in this newsgroup in that time, so probably most won't know of its existence (and also, many of those who used to post back then don't post now). Well... What do you guys (Walter especially) think about it?Ah, the ghost of postings past <g>. I was wrong. The trouble with :+: being for overloaded operators and + for builtin operators is that generic templates don't work. It has to be the same operator token.
Aug 21 2002
I was wrong. The trouble with :+: being for overloaded operators and + for builtin operators is that generic templates don't work. It has to be the same operator token.Ok, but I mainly meant about the other stuff... About using other symbols as operators...
Aug 21 2002
"Carlos" <carlos8294 msn.com> wrote in message news:ak21oi$30gn$1 digitaldaemon.com...Ok, but I mainly meant about the other stuff... About using other symbolsasoperators...I still like that idea.
Aug 22 2002
I want to use Unicode math symbols as operators ;) Dot and cross product etc. Union, Intersection. Almost Equal To. Similar To. So many things that are standard math symbols and are hard to type out with words. Sean "Carlos" <carlos8294 msn.com> wrote in message news:ak21oi$30gn$1 digitaldaemon.com...forI was wrong. The trouble with :+: being for overloaded operators and +asbuiltin operators is that generic templates don't work. It has to be the same operator token.Ok, but I mainly meant about the other stuff... About using other symbolsoperators...
Aug 22 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ak3600$231d$1 digitaldaemon.com...I want to use Unicode math symbols as operators ;) Dot and cross product etc. Union, Intersection. Almost Equal To. Similar To. So many things that are standard math symbols and are hard to type out with words.I've been thinking that it might be possible to predefine some of those as tokens, and then allow operator overloading of them.
Aug 22 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ak3600$231d$1 digitaldaemon.com...I want to use Unicode math symbols as operators ;) Dot and cross product etc. Union, Intersection. Almost Equal To. Similar To. So many things that are standard math symbols and are hard to type out with words.What text editor would you use to program, then? Ahem... Salutaciones, JCAB
Aug 22 2002
On Thu, 22 Aug 2002 13:12:54 -0700 "Juan Carlos Arevalo Baeza" <jcab JCABs-Rumblings.com> wrote:What text editor would you use to program, then? Ahem...BeOS StyleEdit. Or QNX Ped. Or maybe just FAR. =)
Aug 22 2002
That's a good question, and I don't have a good answer. But I do find it hard to believe that UTF-8 and Unicode fonts have been around for this long without some fool making a truly unicode compatible text editor. I just tried TextPad and though it claims Unicode and UTF-8 support for file formats, it won't display the characters properly. I suppose I could always use MS Word as an editor. ;( Sean "Juan Carlos Arevalo Baeza" <jcab JCABs-Rumblings.com> wrote in message news:ak3g7p$2edc$1 digitaldaemon.com..."Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ak3600$231d$1 digitaldaemon.com...productI want to use Unicode math symbols as operators ;) Dot and crossthingsetc. Union, Intersection. Almost Equal To. Similar To. So manythat are standard math symbols and are hard to type out with words.What text editor would you use to program, then? Ahem... Salutaciones, JCAB
Aug 23 2002
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message news:ak5p89$20d4$1 digitaldaemon.com...That's a good question, and I don't have a good answer. But I do find it hard to believe that UTF-8 and Unicode fonts have been around for thislongwithout some fool making a truly unicode compatible text editor. I just tried TextPad and though it claims Unicode and UTF-8 support for file formats, it won't display the characters properly. I suppose I could always use MS Word as an editor. ;(The source to MicroEmacs comes with the compiler. If the operating system can display unicode characters, then it would be fairly trivial to change ME to edit unicode.
Aug 23 2002
"Walter" <walter digitalmars.com> wrote in message news:ak5qb4$21dc$3 digitaldaemon.com...The source to MicroEmacs comes with the compiler. If the operating system can display unicode characters, then it would be fairly trivial to changeMEto edit unicode.Display is one end of it. Input is another. How would you type the new characters in the editor? I've always seen UNICODE as a post-process stuff that kind of happens behind the scenes but you hardly ever see while you program. I would really _love_ to see a real, usable UNICODE editor in action. Salutaciones, JCAB
Aug 23 2002
"Juan Carlos Arevalo Baeza" <jcab JCABs-Rumblings.com> wrote in message news:ak6ftm$2p80$1 digitaldaemon.com..."Walter" <walter digitalmars.com> wrote in message news:ak5qb4$21dc$3 digitaldaemon.com...systemThe source to MicroEmacs comes with the compiler. If the operatingchangecan display unicode characters, then it would be fairly trivial toMEInput it as: <METAKEY> UUUU Ugly, but workable for occaisonal use.to edit unicode.Display is one end of it. Input is another. How would you type the new characters in the editor? I've always seen UNICODE as a post-process stuff that kind of happens behind the scenes but you hardly ever see while you program. I would really _love_ to see a real, usable UNICODE editor in action.
Aug 23 2002
Just cut'n'paste from the Character Map tool. Sean "Walter" <walter digitalmars.com> wrote in message news:ak6ktk$2uip$1 digitaldaemon.com..."Juan Carlos Arevalo Baeza" <jcab JCABs-Rumblings.com> wrote in message news:ak6ftm$2p80$1 digitaldaemon.com...new"Walter" <walter digitalmars.com> wrote in message news:ak5qb4$21dc$3 digitaldaemon.com...systemThe source to MicroEmacs comes with the compiler. If the operatingchangecan display unicode characters, then it would be fairly trivial toMEto edit unicode.Display is one end of it. Input is another. How would you type thestuffcharacters in the editor? I've always seen UNICODE as a post-processthat kind of happens behind the scenes but you hardly ever see while you program. I would really _love_ to see a real, usable UNICODE editor in action.Input it as: <METAKEY> UUUU Ugly, but workable for occaisonal use.
Aug 24 2002
On Sat, 24 Aug 2002 11:52:35 -0700 "Sean L. Palmer" <seanpalmer earthlink.net> wrote:Just cut'n'paste from the Character Map tool.Conclusion: any D IDE should support Unicode.
Aug 24 2002
On Fri, 23 Aug 2002 16:25:58 -0700 "Juan Carlos Arevalo Baeza" <jcab JCABs-Rumblings.com> wrote:Display is one end of it. Input is another. How would you type the new characters in the editor? I've always seen UNICODE as a post-process stuffThere are different keyboard mappings, and many OSes allow you to create your own - so one could create such a mapping, for example I could do it for BeOS, and then just switch back and forth. Then the only problem would be to remember which key corresponds to which operator.
Aug 24 2002
"Carlos" <carlos8294 msn.com> escribió en el mensaje news:ak1n98$utk$1 digitaldaemon.com...Hi all... Outlook Express did a weird thing and started to download ALL the messages in this newsgroup (I stopped before it was finished), but it was goodYou can call me crazy (actually, you'd be right if you do that ;) ), but I did it. I downloaded d in news.digitalmars.com. It's damn late here (over 3 in the morning), but I gues that reading 6700+ posts will help me learn more D. Yes, I have lots of reading. Let's see what happens...
Aug 22 2002