On 2013-02-13 09:34, Marco Leise wrote:
Am Tue, 12 Feb 2013 13:38:53 +0100
schrieb Jacob Carlborg <[email protected]>:

I've compiled a list below of things used in Orbit (directly or
indirectly) that Phobos is lacking in. Please tell me if I'm wrong:

I can only tell you what of that list I would have had a use
for myself in the past:

    * Configuration

Yes, native to the environment (e.g. use \AppData\Roaming on
Windows or .config on Linux)

I didn't necessarily mean native configuration. I was referring to configuration internally for the application. But it could be useful to save to disk as well.

All of that except "action" and "multiple command lines".
Validation is probably too complex to include at the spot. I
mean, sometimes you need to validate the combination of all
options, so you can just as well write a separate function.

I would I do that when I only need so simple validation? Like that an argument is required. The arguments parser in Tango can handle validation.

CTFE:

I think most of that exists in Phobos or can be constructed in
one line of code:

* format - A simple formatting function

http://dlang.org/phobos/std_metastrings.html#.Format

* indexOf

http://dlang.org/phobos/std_typetuple.html#.staticIndexOf

* contains

staticIndexOf!(something, Tuple) != -1

* fieldsOf - Returns all the fields of the given type

http://dlang.org/phobos/std_traits.html#.FieldTypeTuple

* hasField - Returns true if the given type has the given field

staticIndexOf!(field, fieldsOf!Type) != -1

That's good. But I would really prefer something like "hasField" instead of the above. It clearly shows that's going on.

* TypeOfField - Returns the type of a field
* nameOfFieldAt - Returns the name of the field at the given position
* set/getValueOfField - Sets/gets the value of a field

:( No idea... at least without mixins.

There's no reason for mixins.

So I figure, Object.factory("ClassName") is too limited. I
used to just force my code work with that one.

Yes, it's too limited. Object.factory will only work for classes with a default constructor or a constructor which doesn't take any arguments.

If it's unclear, I already have all of this functionality implemented. It's just not in Phobos.

--
/Jacob Carlborg

Reply via email to