What's missing from Phobos for Orbit (package manager)

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Feb 13 07:58:39 PST 2013


13-Feb-2013 12:34, Marco Leise пишет:
> Am Tue, 12 Feb 2013 13:38:53 +0100
> schrieb Jacob Carlborg <doob at me.com>:
>
>> 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)
>
>> * ConfigMap -  Does not exist. An associative array with opDispatch
>> added to it. Allows to do things like:
>>
>> auto config = ConfigMap();
>> config.foo = "asd";
>> config.bar.foo.baz = "foobar";
>>
>> assert(config.foo == "asd");
>
> I loaded an .INI template at CT (with default values and type
> inference) and created nested structs from that. Was fun to do
> in D. No matter what the implementation is, this is useful.
>
>> * std.process - I have not used it myself but I've heard it's not optimal
>
> The biggest shortcoming is that you cannot do IPC with it, as
> it doesn't give you two-way pipes to the child process. Again,
> that's useful and IIRC was in the std.process replacement.
>
>> * std.getopt - Doesn't support the following:
>>     * Required arguments
>>     * Restricting the values of a given argument
>>     * No way to automatically create a help/usage list out of the arguments
>>     * Handling positional arguments
>>     * No support for commands/action. That is "git commit", "commit"
>> would be the command/action
>>     * Handle multiple command lines
>>     * Validation of the arguments
>
> 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.
>
>> 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

This should never see the light of day. Use plain format from std.string 
it works with CTFE and many, many times faster.

In fact the whole metastrings should be obliterated.



-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list