Few things II

Sean Kelly sean at f4.ca
Tue Aug 7 13:01:42 PDT 2007


Oskar Linde wrote:
> bearophile wrote:
> 
>> 21) In this newsgroup I've seen that people like a lot the ability of 
>> doing:
>> txt.split()
>> But I don't like it much because it's a syntactical sugar that masks 
>> the fact that those split are functions (that pollute the namespace) 
>> and they aren't true methods (object functions). That namespace 
>> pollution may cause problems, if you have already defined elsewhere a 
>> function with the same name and similar signature.
> 
> I disagree. First, the name space "pollution" is no problem in D. You 
> can never accidentally call an unwanted overload of a function from 
> another module. D will issue an ambiguity error when the same identifier 
> matches instances in several different modules.
> 
> Secondly, I have really grown to like the way of chaining functions on 
> arrays. The function call order and the data flow is read left to right. 

Another advantage is that the property syntax can simplify template code 
in some cases because it allows arrays to be treated as if they were 
UDTs so long as the proper support routine is available.  To me, this 
goes a long way towards supporting arrays as viable containers.


Sean



More information about the Digitalmars-d mailing list