Should this work?

Regan Heath regan at netmail.co.nz
Wed Jan 29 02:13:43 PST 2014


On Wed, 29 Jan 2014 09:52:01 -0000, Dicebot <public at dicebot.lv> wrote:

> On Tuesday, 28 January 2014 at 11:26:39 UTC, Regan Heath wrote:
>> No, you really don't.
>>
>> If you're writing string code you will intuitively reach for  
>> "substring", "contains", etc because you already know these terms and  
>> what behaviour to expect from them.  In a generic context, or a range  
>> context you will reach for different generic or range type names.
>
> Trusting intuition is not acceptable.

Sure it is, if we're talking about making life easier for beginners and  
making things more "obvious" in general.  Of course, not everyone has the  
same idea of obvious, but there is enough overlap and we would *only*  
define aliases for that overlap.  In short, if people expect it to be  
there, lets make sure it's there.

> I will go and check in docs in most case if I have not encountered it  
> before. Check each time for every new aliases. I'd hate to have this  
> overhead.

Huh?  Assuming you have a decent editor checking the docs should be as  
simple as pressing F1 on the unknown function.  And, that's only assuming  
it's not immediately obvious what it's doing.  Are you telling me, that  
you would be confused by seeing...

if (str.contains("hello"))

I seriously doubt that, and that's all I'm suggesting, adding aliases for  
things which are obvious, things which any beginner will expect to be  
there, and currently aren't there.

I am *not* suggesting we add every obscure name for every single function,  
that would be complete nonsense.  Lets not get confused about the scope of  
what I'm suggesting, I am suggesting a very limited number of new aliases,  
and only for cases where there is a clear obvious expected name which we  
currently lack.

> Right now all I need to do is to stop thinking about strings as strings  
> - easy and fast.

Sure, once you learn all the generic terms for things.  I *still* have  
trouble finding the LINQ function I need when I want to do something in  
the LINQ generic style .. and I've been using LINQ for at least a year  
now.  The issue is that the generic name just does not naturally occur to  
me in certain contexts, like strings.

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list