dst = src rather than src dst

Kirk McDonald kirklin.mcdonald at gmail.com
Thu Sep 6 11:26:15 PDT 2007


Janice Caron wrote:
> -----Original Message-----
> From: digitalmars-d-bounces at puremagic.com 
> [mailto:digitalmars-d-bounces at puremagic.com] On Behalf Of Kirk McDonald
> Sent: 06 September 2007 09:14
> To: digitalmars-d at puremagic.com
> Subject: Re: dst = src rather than src dst
> 
>> I just don't particularly like it very much. This is primarily because
>> it's merely a syntax change.
> 
> D is an evolving language. It's had lots of syntax changes in the past.
> 
>> If the old syntax is retained, we have redundant syntaxes, which is 
>> annoying and not a good thing.
> 
> Hmmm....
> 
> char[] x;
> char x[];
> 

This is precisely the sort of thing I'm talking about. I'd list this as 
a case where the increased clarity of the new syntax is absolutely worth 
it, but these redundant syntaxes are still annoying and I don't like the 
fact we have to have 'em.

> Double Hmmm....
> 
> void f(static int x) {...}
> void f(int x)() {...}
> template f(int x) { void f() {...} }
> 

The second and third forms you have here aren't so much redundant syntax 
as the full syntax and the shorthand syntactic sugar for same. The first 
syntax is different, in that you call it differently:

f(1);
// vs
f!(2);

> Hmmm again...
> 
> find(s,'\n');
> s.find('\n');
> 

This I'll grant you. However, when this gets working for all types, it 
will be less a syntactic redundancy and more of an orginizational 
nicety. (You'll be able to split some methods out of a class, and 
perhaps into a seperate module, or even extend an existing class with 
your own "methods.")

I've already spent more time in this thread than I intended to. Despise 
this, /I don't care that much/ about whether this syntax is added. If it 
were put to a vote, I would abstain. I'm merely pointing out that adding 
new syntax which does not actually do anything new should on principle 
be avoided.

-- 
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org



More information about the Digitalmars-d mailing list