Should this work?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jan 27 08:19:54 PST 2014


On 1/27/14 6:27 AM, Regan Heath wrote:
> On Sat, 25 Jan 2014 10:15:28 -0000, Peter Alexander
> <peter.alexander.au at gmail.com> wrote:
>> Special cases are pure evil. There's nothing special about strings in
>> this case.
>
> This is a tangent to my suggestion.
>
> I am arguing for domain specific language (aliases) where sensible, not
> domain specific functions.  If canFind can already handle all the
> desirable string cases, perfect, but lets alias it in std.string as
> "contains" so that people find what they expect to find first time and
> don't get frustrated looking for the correct generic name for the
> functionality they want.
>
> There are likely other cases where we already have all the functionality
> in a nice generic function, but people struggle to find it because it
> has a suitably generic name.
>
> I just want us to lower the bar for beginners coming from other
> languages like Java and C#.

I just don't think this scales, though I understand it can sound 
reasonable before it being tried.

Walter doesn't like writing libraries so when he first defined Phobos' 
string support he simply took the string functions in Python and Ruby 
and implemented them. That didn't work well at all, in spite of the 
functions having the same names and semantics.


Andrei



More information about the Digitalmars-d mailing list