opStar

Bill Baxter dnewsgroup at billbaxter.com
Sun Nov 11 16:40:25 PST 2007


0ffh wrote:
> Bill Baxter wrote:
>> First, let's call it opDeref because, to quote Walter re opAdd:
> 
> ++votes
> 
>> 3) Introduce an alternate member access syntax for 'raw' member 
>> access.  Like x:member, x::member, x->member,  x..member.
> 
> Yup, I'd like "->" for "dumb" dereferencing and "." for "smart".
> Also, Janices idea to have "." do multi-level dereferencing is surely
> worth a closer look. If it wasn't for the large user base, I'd say
> "It sounds good, let's try and see what comes of it!"... =)

Well, if polls can be trusted, the 2.0 user base is about 1/4 the size 
of 1.x user base, and the 2.0 *code* base is probably more like 1/100 or 
less.

Anyway, I'd like to have "." do multi-level dereferencing too.  I just 
suspected that wasn't on the table as it's been discussed before.  But 
maybe there's still hope there.

Also I noticed that if smart member access is going to be the default 
then it seems necessary to make clear it doesn't apply to operators. 
That is, ++p may be equivalent to p.opPreIncr generally, but that 
doesn't mean that ++p will call p.opDeref.opPreIncr.  For that you'll 
still need the explicit dereference: ++(*p).

Without that rule iterators will look pretty ugly.

--bb



More information about the Digitalmars-d mailing list