std.uuid: Ranges as parser input

Johannes Pfau nospam at example.com
Sun Jun 10 02:05:26 PDT 2012


Am Sat, 09 Jun 2012 23:06:25 -0700
schrieb Walter Bright <newshound2 at digitalmars.com>:

> On 6/9/2012 10:30 AM, Dmitry Olshansky wrote:
> > The review process stalled long enough, let's kick start it with a
> > small yet a valuable module that was there for quite some time.
> 
> Great! My initial suggestion is that the parsing routines should
> accept input ranges, rather just arrays.
> 

That could be done, but I currently keep the complete input string in
the ParserException. That wouldn't be possible if the parser has to
operate on an InputRange. It could work with a ForwardRange, but
converting the Range back to a string wouldn't be very efficient. This
would work best with some kind of BufferedRange/Stream concept.

I'm just wondering whether it really makes sense to use ranges in this
case. The text representation of UUIDs is usually exactly 36 characters
long (for the simple parser it must be exactly 36 characters), so when
using some kind of range interface and std.uuid it should be easy enough
to read the UUID string into a stack buffer, then pass it to std.uuid.

But if it's really desired, I can sure add an implementation using
ForwardRanges.



More information about the Digitalmars-d mailing list