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

Jacob Carlborg doob at me.com
Tue Feb 12 06:38:45 PST 2013


On 2013-02-12 15:21, Steven Schveighoffer wrote:
> Some answers:
>
> On Tue, 12 Feb 2013 07:38:53 -0500, Jacob Carlborg <doob at me.com> wrote:
>
>> * std.process - I have not used it myself but I've heard it's not optimal
>
> I want to get this remedied.  Won't make it in 2.062, but I want to
> finish this in the next month.
>
>> * 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
>
> I know std.getopt doesn't support all these, but couldn't you support
> them externally?  I mean, let getopt assign the values, then perform the
> logic based on what you got?  You have to write the logic anyway.  I
> suppose one of the missing pieces here is whether an option was present
> or not.  All you get is the result.
>
> You can handle the command before handling the options, as long as you
> require the command to be the first parameter.
>
>> Various convince functions:
>>
>> * any - Opposite of empty
>
> !empty
>
>> * last - Returns the last element of an array
>
> arr[$-1];
> arr.back;
>
>> * map, find and any for associative arrays
>
> Really, we need an AA range...
>
>> * pluralize - Takes a string and a count. If the count is greater than
>> 1 it converts the word in the string to plural
>
> basic version:
> string pluralize(string x, int count)
> {
>     return count > 1 ? x ~ "s" : x;
> }
>
> Now, you probably would need a simple mechanism to do the different
> plural forms.  Sometimes 'es' must be added, sometimes 'y' must be
> changed to 'ies', etc.  But that should be a simple switch statement.
> The switch statement would select a different ending, and a prefix count
> based on the current ending.
>
> Then the return would be:
>
> return count > 1 ? x[0..pcount] ~ ending : x;

I don't need examples of how to implement these functions. I'm asking 
what of these could we add to Phobos. I already have all the 
functionality in place. I'm trying to estimate the cost of moving these 
to Phobos, if it's worth porting Orbit to only use Phobos.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list