Proposal: Make [][x] and [][a..b] illegal (reserve for multidimensional arrays)
Bill Baxter
dnewsgroup at billbaxter.com
Thu Nov 22 02:52:13 PST 2007
Oskar Linde wrote:
> Bill Baxter wrote:
>
>> Anyway, f[i][j][k] syntax is much more difficult to read than
>> f[i,j,k]. So I think the latter is what we should be shooting for.
>
> I agree, and for what it is worth it is possible to implement
> multidimensional indexing and slicing for UDTs today. The only thing
> lacking is the ability to use the .. and $ tokens. For example:
>
> f[i, all, all, j, all, end-1, all, range(1, end)]
>
> gets translated into quite optimal code. The only variables that get
> passed to the indexing function is (i,j,1,1) and no temporaries need to
> be created. I guess that with some additional compiler supported
> sugaring, the above could become something like:
>
> f[i, .. , .. , j, .. , $-1, .. , 1..$]
>
Now if you would just put all that goodness on Dsource or somewhere
where the rest of us can appreciate it... :-)
--bb
More information about the Digitalmars-d
mailing list