Heretical template syntax proposal

Bill Baxter wbaxter at gmail.com
Wed Oct 22 22:32:35 PDT 2008


On Thu, Oct 23, 2008 at 2:02 PM, Bill Baxter <wbaxter at gmail.com> wrote:
> In another thread the idea was discussed of using [x] for template arguments.
>
> The main objection to this was that it would be ambiguous with array indexing.
> I know [x] has meant array indexing for a long time, but I think
> there's not really any longstanding connection between that and any
> math notation that existed previously.
> In fact (x) is arguably a more mathematical way to index an array.  An
> array is just a function that given some input returns some output.
> So array(i) actually makes a lot of sense.
>
> This is actually how Matlab behaves, in fact.   In Matlab you don't
> index with [i] you index with (i).


Just remembered -- Fortran also uses parens instead of square brackets
for indexing and declaring arrays.

--bb



More information about the Digitalmars-d mailing list