Thread overview | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 05, 2003 Operator overloading | ||||
---|---|---|---|---|
| ||||
I'm sure this was discussed before, but I haven't been on this group for a long time. So could somebody explain me, why names are used instead of the C++ like operator foo? To me it's much more intuitiv to write "operator +=" instead of "addass". |
November 05, 2003 Re: Operator overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Becker | In article <bob3sq$2n8p$1@digitaldaemon.com>, Matthias Becker says... > >I'm sure this was discussed before, but I haven't been on this group for a long time. So could somebody explain me, why names are used instead of the C++ like operator foo? To me it's much more intuitiv to write "operator +=" instead of "addass". > > I have the same question. Ant |
November 05, 2003 Re: Operator overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | I agree on this one also, just some ideas but if not operator foo something like __+=__ () { } __++__ () { } A little pythonesque ? C "Ant" <Ant_member@pathlink.com> wrote in message news:bob4r4$2oo1$1@digitaldaemon.com... > In article <bob3sq$2n8p$1@digitaldaemon.com>, Matthias Becker says... > > > >I'm sure this was discussed before, but I haven't been on this group for a long > >time. So could somebody explain me, why names are used instead of the C++ like > >operator foo? To me it's much more intuitiv to write "operator +=" instead of > >"addass". > > > > > > I have the same question. > > Ant > > |
November 05, 2003 Re: Operator overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Becker | "Matthias Becker" <Matthias_member@pathlink.com> wrote in message news:bob3sq$2n8p$1@digitaldaemon.com... | I'm sure this was discussed before, but I haven't been on this group for a long | time. So could somebody explain me, why names are used instead of the C++ like | operator foo? To me it's much more intuitiv to write "operator +=" instead of | "addass". | | Over a year ago (about june-august 2002) there was a votation about this, and that was the winning convention. ————————————————————————— Carlos Santander "Matthias Becker" <Matthias_member@pathlink.com> wrote in message news:bob3sq$2n8p$1@digitaldaemon.com... | I'm sure this was discussed before, but I haven't been on this group for a long | time. So could somebody explain me, why names are used instead of the C++ like | operator foo? To me it's much more intuitiv to write "operator +=" instead of | "addass". | | Over a year ago (about june-august 2002) there was a votation about this, and that was the winning convention. ————————————————————————— Carlos Santander |
November 05, 2003 Re: Operator overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Sanders | In article <bobc3l$2rt$1@digitaldaemon.com>, Charles Sanders says... > >I agree on this one also, just some ideas but if not operator foo something like > >__+=__ () { } >__++__ () { } > >A little pythonesque ? > I think I like it. (never though I would say that about "_") Can we do: alias addass __+=__; or someting like that? Ant |
November 05, 2003 Re: Operator overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Becker | "Matthias Becker" <Matthias_member@pathlink.com> wrote in message news:bob3sq$2n8p$1@digitaldaemon.com... > I'm sure this was discussed before, but I haven't been on this group for a long > time. So could somebody explain me, why names are used instead of the C++ like > operator foo? To me it's much more intuitiv to write "operator +=" instead of > "addass". The reason is because of the ability to write the reverse operator overloads, and to make the overloads easilly greppable. |
November 05, 2003 Re: Operator overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | I've been lurking here for a year or more, enjoying the fact that this project is progressing steadily. Keep up the good work, Walter and everyone else. As for operator overloading, I like the naming convention, but I think all names should be prefixed with op, as in opCall to make it clear we are dealing with operators. Names like add are actually quite common, e.g. in collection classes. Matthias In article <bobi49$cde$1@digitaldaemon.com>, Walter says... > > >"Matthias Becker" <Matthias_member@pathlink.com> wrote in message news:bob3sq$2n8p$1@digitaldaemon.com... >> I'm sure this was discussed before, but I haven't been on this group for a >long >> time. So could somebody explain me, why names are used instead of the C++ >like >> operator foo? To me it's much more intuitiv to write "operator +=" instead >of >> "addass". > >The reason is because of the ability to write the reverse operator overloads, and to make the overloads easilly greppable. > > > |
November 06, 2003 Re: Operator overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Spycher | This sounds good ( prefixing with op ), I just dont like the word ass everywhere in my code. C "Matthias Spycher" <matthias@coware.com> wrote in message news:bobmno$jge$1@digitaldaemon.com... > I've been lurking here for a year or more, enjoying the fact that this project > is progressing steadily. Keep up the good work, Walter and everyone else. > > As for operator overloading, I like the naming convention, but I think all names > should be prefixed with op, as in opCall to make it clear we are dealing with > operators. Names like add are actually quite common, e.g. in collection classes. > > Matthias > > > In article <bobi49$cde$1@digitaldaemon.com>, Walter says... > > > > > >"Matthias Becker" <Matthias_member@pathlink.com> wrote in message news:bob3sq$2n8p$1@digitaldaemon.com... > >> I'm sure this was discussed before, but I haven't been on this group for a > >long > >> time. So could somebody explain me, why names are used instead of the C++ > >like > >> operator foo? To me it's much more intuitiv to write "operator +=" instead > >of > >> "addass". > > > >The reason is because of the ability to write the reverse operator overloads, and to make the overloads easilly greppable. > > > > > > > > |
November 06, 2003 Re: Operator overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Good thinking, the alias doesnt like operators though :(. C "Ant" <Ant_member@pathlink.com> wrote in message news:bobdkv$56l$1@digitaldaemon.com... > In article <bobc3l$2rt$1@digitaldaemon.com>, Charles Sanders says... > > > >I agree on this one also, just some ideas but if not operator foo something > >like > > > >__+=__ () { } > >__++__ () { } > > > >A little pythonesque ? > > > > I think I like it. > (never though I would say that about "_") > > Can we do: > alias addass __+=__; > or someting like that? > > > Ant > > |
November 06, 2003 Re: Operator overloading | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Spycher | "Matthias Spycher" <matthias@coware.com> wrote in message news:bobmno$jge$1@digitaldaemon.com... > I've been lurking here for a year or more, enjoying the fact that this project > is progressing steadily. Keep up the good work, Walter and everyone else. Thanks! > As for operator overloading, I like the naming convention, but I think all names > should be prefixed with op, as in opCall to make it clear we are dealing with > operators. Names like add are actually quite common, e.g. in collection classes. You're right, I've been intending to do this, but I hate upsetting existing code. |
Copyright © 1999-2021 by the D Language Foundation