www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21650] New: parse form that returns elements parsed is too

https://issues.dlang.org/show_bug.cgi?id=21650

          Issue ID: 21650
           Summary: parse form that returns elements parsed is too
                    difficult to use
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: schveiguy gmail.com
                CC: adela.vais99 gmail.com

Based on this PR: https://github.com/dlang/phobos/pull/7642 and issue 21233

parse gained an extra parameter which is a Flag, and that indicates whether the
return should include a size_t of how many items were parsed.

However, the ordering of the new parameter makes it difficult to use, you have
to specify the source type in order to get to the Flag parameter.

By adding additional overloads in the form:

parse(Target, Flag!"doCount", Source)(Source rng)

the flag is more accessible. I should not have to specify the Source type in
order to specify the flag.

In fact, I think this could have been done with an overload originally, but at
this point, code probably already exists that uses the form `parse!(long,
typeof(s), Yes.doCount)(s)`

--
Feb 19 2021