Please vote once and for good: range operations

Steven Schveighoffer schveiguy at yahoo.com
Wed Jan 28 17:51:53 PST 2009


"Andrei Alexandrescu"  wrote
> C#:
> Couldn't find after searching MS's asinine dox for 5 mins.
>

C# doesn't seem to have bi-directional ranges.  Only forward ones.  In any 
case, they are enumerated over using an IEnumerator (or IEnumerator<T>, 
depending on whether you want generic support).  In any case, the "head" 
element is the property "Current".

In a container, you can only get the last element of something that has an 
indexer, and in that case, its:

container[container.Count - 1];

So I'm not sure there's any point in listing C# as a viable candidate to 
steal property names from ;)  C# and .net in general I think suck in terms 
of standard containers/algorithms anyways.  It's one thing I don't like 
about it.

references:
http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.current.aspx
http://msdn.microsoft.com/en-us/library/ewthkb10.aspx

In any case, I think front and back make the most sense to me.  I did come 
from C++ however...

I don't mind any of the normal choices (I don't count car as being 
'normal'), but if Walter insists on keeping foreach_reverse, let's all 
remember that whatever is chosen for the rear/toe/last element of a range is 
going to be embedded in the compiler/spec, and essentially set in stone.

-Steve 





More information about the Digitalmars-d mailing list