opStar

Michel Fortin michel.fortin at michelf.com
Sun Nov 11 12:38:41 PST 2007


On 2007-11-11 14:33:55 -0500, Walter Bright <newshound1 at digitalmars.com> said:

> Michel Fortin wrote:
>> I can't comment much on that since the details are so scarse, but I 
>> hope you don't use the same syntax as in C++ for iterators. I've never 
>> like much C++ pointer-like iterators, and I don't think working with 
>> iterators should feel like we're manipulating pointers.
> 
> The thing is that loops are a very fundamental construct, and being to 
> implement them efficiently is of major importance. The pointer idiom 
> has the advantage there.

Hum, I'm not sure I follow you here. I say I dislike the C++ syntax for 
iterators (because the syntax make it look like a pointer) and your 
reply is that pointers are more efficient... Pointer are efficient 
indeed, but pointers should be an implementation detail that has 
nothing to do about the syntax for iterators. My point was aboout the 
syntax, not the implemenation.

If you implement the iterator as a struct having a pointer then that's 
perfect with me. If the iterator has a pointer-like syntax, then it 
won't be my prefered syntax, but I can digest. If the iterator has only 
a half-pointer-like syntax -- like needing an explicit parenthesis and 
dereferenciation asterisk (*a).b to access the members of the 
pointed-to element instead of the simpler a.b you can use with a real 
pointers -- then that's downright bad in my opinion.

But as I said, I haven't seen what you're planing for iterators, so 
perhaps it's better than what I'm currently imagining.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list