April 17, 2002 Re: Array comparisons | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert W. Cunningham | In article <3CBCEF97.FCCDA985@acm.org>, Robert W. Cunningham says...
>
>Walter wrote:
>
>> "Russell Borogove" <kaleja@estarcion.com> wrote in message news:3CBCCA22.9030407@estarcion.com...
>> > Walter wrote:
>> > > Hmm, maybe "if (a [==] b)" ?? I have to think about this some more.
>> > Ewwwww.
>>
>> <cough cough> I guess that settles it <g>
>
>Well, how about: "if (a is b)"?
>
>Yes, YAKW (Yet Another KeyWord). But it does flow, doesn't it?
>
>We could always FORTRAN-ize it: "if (a .IS. b)"
>
>How about a trigraph?
How about a GIF of a cat that eats a mouse? :-)
Ciao
|
April 17, 2002 Re: Array comparisons | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | I don't see what the problem is. The reference should be a basically hidden thing anyway, acting for all intents and purpose like it actually *is* the object it refers to. You've seen references in C++... the following C++ code is completely legal (and I use stuff like this on a regular basis): class Foo { }; Foo a; Foo& aref = a; Foo* arefptr = &aref; assert(arefptr == &a); Sean "Walter" <walter@digitalmars.com> wrote in message news:a9i80p$1v5a$1@digitaldaemon.com... > > "Richard Krehbiel" <rich@kastle.com> wrote in message news:a9hq7r$1385$1@digitaldaemon.com... > > "Walter" <walter@digitalmars.com> wrote in message > > But, do you compare references *more* *often* than you compare content? > How > > often would a reference comparison be a mistake rather than the intent? > > Hard to say. With string arrays, I compare content. With objects, I compare > references. > > > I think content comparison is much more likely to be a programmer's > intent, > > so when he codes "if(objA == objB)", do a content comparison. When he > > intends reference comparison, he can code "if(&objA == &objB)". > > &x means the address of the reference. I don't think that will semantically > work. > > Hmm, maybe "if (a [==] b)" ?? I have to think about this some more. |
April 17, 2002 Re: Array comparisons | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | "Sean L. Palmer" <spalmer@iname.com> wrote in message news:a9jh6h$2vb3$1@digitaldaemon.com... > I don't see what the problem is. The reference should be a basically hidden > thing anyway, acting for all intents and purpose like it actually *is* the object it refers to. You've seen references in C++... the following C++ This understanding of reference I've only seen in C++ so far. Ask any Delphi, or VB, or Java programmer, they tell you that reference is practically just a pointer that doesn't support pointer arithmetic. This comes from the fact that C++ references are constant, while in D they change. |
April 17, 2002 Re: Array comparisons | ||||
---|---|---|---|---|
| ||||
Posted in reply to Karl Bochert | "Karl Bochert" <kbochert@ix.netcom.com> wrote in message news:1103_1019015587@bose... > On Tue, 16 Apr 2002 12:21:21 -0700, "Walter" <walter@digitalmars.com> wrote: > > > > &x means the address of the reference. I don't think that will semantically > > work. > > > > Hmm, maybe "if (a [==] b)" ?? I have to think about this some more. > > > if ( a := b ) > if ( a === b ) // my favorite -- they are really, really the same > if ( a <eq> b ) > if ( identical ( a, b ) ) As someone posted before, why not use the notion of properties of an object with the dot notation? This meakes things really clear, i.e. prevents confusion. For example if (a.id == b.id) // where id is a property of the object - its unique identity, probably its address. or converesly if (a.content == b.content) // clearly not the address comprisons Chose whatever key words you want, etc. but why do we need confusing special character sequences when short words convey what is going on so much better and thus avoid confusion? Surely we are past the days when C was designed to minimize keystrokes because they were done on a KSR 33 teletype at 110 baud. -- - Stephen Fuld e-mail address disguised to prevent spam |
April 18, 2002 Re: Array comparisons | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:a9j73p$2mhs$1@digitaldaemon.com... > > "OddesE" <OddesE_XYZ@hotmail.com> wrote in message news:a7tk0m$2rgu$1@digitaldaemon.com... > > Sorry for grabbing the hand as soon as you give me a > > finger, but I love the concept of operator overloading, > > and this would make it fairly transparent to implement. > > Also, operator overloading haters could always directly > > call the normal functions. > > It does seem like I've fallen backwards into supporting operator overloading > <g>. > I'd rather call it jumping forwards ;) But what about it? Any plans on add, subtract, divide and multiply? (Sorry, gotta ask :) ) -- Stijn OddesE_XYZ@hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail |
April 19, 2002 Re: Array comparisons | ||||
---|---|---|---|---|
| ||||
Posted in reply to OddesE | "OddesE" <OddesE_XYZ@hotmail.com> wrote in message news:a9n0gm$2vvl$1@digitaldaemon.com... > > It does seem like I've fallen backwards into supporting operator > overloading > > <g>. > I'd rather call it jumping forwards ;) > > But what about it? Any plans on add, subtract, > divide and multiply? (Sorry, gotta ask :) ) Right now I want to finish what I've got, and ship it. There's always 2.0! |
Copyright © 1999-2021 by the D Language Foundation