dlang-community / SDLang-D

An SDLang (Simple Declarative Language) library for D
http://sdlang.org
Other
120 stars 21 forks source link

Add firstXXX for all lookup methods #6

Closed zhaopuming closed 8 years ago

zhaopuming commented 10 years ago

we have .tags .attributes and other methods that return a range/array, but in most many cases there is only one children, it would be great if we can access that with .firstChild, .firstTag, or .firstAttr.

We can have some templates to generate these companion firstXXX methods.

Abscissa commented 8 years ago

The API definitely needs some simplifications like this for typical basic use-cases.

In addition to firstXXX methods, what I really want to get around to is defining an SDLang schema format (in SDLang, naturally) which could then be parsed at compile-time to auto-generate a really nice API and do all error-checking automatically.

But this is lower-hanging fruit and is definitely needed regardless.