Is [] mandatory for array operations?

Kagamin spam at here.lot
Fri May 7 13:21:40 PDT 2010


Robert Jacques Wrote:

> On Fri, 07 May 2010 09:52:46 -0400, Robert Jacques <sandford at jhu.edu>  
> wrote:
> > Given that y[] is really syntactic sugar y[0..$], one option would be to  
> > bite the bullet an make [] a dedicated array op/vectorize operator. This  
> > would pave the way for using array ops with user defined types (e.g.  
> > matrices and ranges). However, the downside to this is that user types  
> > would loose the x[] = y; and y[] operator overloads. Classes can use x[]  
> > = y to mean copy assignment (since x=y is a ref assignment). Collections  
> > may use y[] as sugar for a .all() method/property. Are there other use  
> > cases?
> 
> On second thought, array ops work with any type of slice: a[0..2] =  
> b[0..2] + c[]; so this is a no go.

So... a different syntax?
a![0..2] = b![0..2] + c![];
or
c[..]


More information about the Digitalmars-d mailing list