A few notes on choosing between Go and D for a quick project

via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 15 03:53:20 PDT 2015


On Sunday, 15 March 2015 at 03:26:01 UTC, Laeeth Isharc wrote:
> Hi.
>
> Some points I think are important follow.  I can't do much on 
> these myself for now as computer use limited by a spinal injury.

That sounds bad. I hope you'll get better!

> 3. I have said so before (the GroupBy docs) - standard library 
> documentation is 'perfectly clear' if you have a technical 
> mindset and are used to reading formalisms, but it is 
> horrendously intimidating if not (which applies to many 
> people).  We need more examples, and they should put the use in 
> context rather than just being tiny fragments - ie show how to 
> do something useful with the function (cf python docs).  There 
> should also be a guide to functions writing from point of what 
> one wants to achieve.  toLower in std.string, but I need to go 
> to std.ascii for doing the same thing to a character.  
> Eminently logical, but not obvious if you don't know where to 
> look.

It seems the accessibility/discoverability of string handling is 
a common complaint. People expect certain functions to be 
available for strings, like startsWith, trim/ltrim/rtrim, repeat, 
maybe even regex matching. Now, these things are all available in 
other parts of Phobos, or easily implementable using components 
from all over the standard library, but a beginner won't know 
this, and even if, it's inconvenient.

Maybe we should add the most common functions to `std.string`? 
Either as aliases or re-exports, or even (re)implement them there 
with the appropriate semantics if necessary. For example, people 
would expect a hypothetical `std.string.repeat` to be eager, 
whereas `std.range.repeat("hello").take(5)` is lazy. Some 
operations may also decay to ranges of `dchar`, but we'd want to 
preserve the string type.


More information about the Digitalmars-d mailing list