www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Ranges in std.range vs foreach ranges

reply Jonathan M Davis <jmdavisProg gmail.com> writes:
The set of properties defined for foreach ranges in the online docs ( 
http://www.digitalmars.com/d/2.0/statement.html ) does not match those of 
the ranges in std.range.

According to the online docs, foreach requires ranges to have

empty
next
retreat
head
toe

while the corresponding properties in std.range would be

empty
popFront
popBack
front
back


Is this because one or the other is not up-to-date? I would assume that we'd 
want the two to match up.

- Jonathan M Davis
Dec 17 2009
parent reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Jonathan M Davis wrote:
 The set of properties defined for foreach ranges in the online docs ( 
 http://www.digitalmars.com/d/2.0/statement.html ) does not match those of 
 the ranges in std.range.
 
 According to the online docs, foreach requires ranges to have
 
 empty
 next
 retreat
 head
 toe
 
 while the corresponding properties in std.range would be
 
 empty
 popFront
 popBack
 front
 back
 
 
 Is this because one or the other is not up-to-date? I would assume that we'd 
 want the two to match up.
 
 - Jonathan M Davis

With D2, the implementation is the real specification. :) The online docs aren't always up-to-date. -Lars
Dec 17 2009
parent retard <re tard.com.invalid> writes:
Thu, 17 Dec 2009 11:13:29 +0100, Lars T. Kyllingstad wrote:

 Jonathan M Davis wrote:
 The set of properties defined for foreach ranges in the online docs (
 http://www.digitalmars.com/d/2.0/statement.html ) does not match those
 of the ranges in std.range.
 
 According to the online docs, foreach requires ranges to have
 
 empty
 next
 retreat
 head
 toe
 
 while the corresponding properties in std.range would be
 
 empty
 popFront
 popBack
 front
 back
 
 
 Is this because one or the other is not up-to-date? I would assume that
 we'd want the two to match up.
 
 - Jonathan M Davis

With D2, the implementation is the real specification. :) The online docs aren't always up-to-date.

To be more precise, I think the official distribution of the dmd binary is the specification, the sources might not behave in the same way and may lack the release tags in the vcs :o) To be sure, I recommend using objdump.
Dec 17 2009