D:YAML 0.3 released
torhu
no at spam.invalid
Thu Nov 17 05:33:07 PST 2011
On 16.11.2011 21:15, Kiith-Sa wrote:
...
> GitHub: https://github.com/kiith-sa/D-YAML
> Docs : dyaml.alwaysdata.net/docs
>
> You can get D:YAML 0.3 here: https://github.com/kiith-sa/D-YAML/downloads
>
Great, I've been looking into YAML lately. Would be interesting to see
how the speed of your library compares to Tango's XML parser. Maybe
I'll do some benchmarking.
I think your API could be simplified in some places. I rewrote one of
your examples:
---
bool constructMyStructScalar(ref Node node, out MyStruct result, out
string customError)
{
auto parts = node.as!string().split(":");
try
{
result = MyStruct(to!int(parts[0]), to!int(parts[1]),
to!int(parts[2]));
return true;
}
catch(Exception e)
{
return false;
}
}
---
If the value is invalid, you just return false and let the library take
care of the rest. If you want to give detailed info about the error,
assign to customError. The code calling this function would throw an
exception that contains the standard line and column info, plus your
custom message.
More information about the Digitalmars-d-announce
mailing list