go-xmlpath / xmlpath

Strict subset of the XPath specification for the Go language.
http://gopkg.in/xmlpath.v2
Other
115 stars 37 forks source link

Fixes go-xmlpath/xmlpath#19 #20

Closed rbarbey closed 8 years ago

rbarbey commented 8 years ago
missedone commented 8 years ago

:+1:

niemeyer commented 8 years ago

That's an iterator over a lazily computed set of nodes. See the implementation of Iter.Next. If you want to know the full length, you'll need to iterate over it and pay the price. I wouldn't like to hide that complexity over a Length() method, and we definitely cannot have it as a field.

These changes should generally be accompanied by a good set of tests. That'd also show you the actual problem with the current approach.