Heretical template syntax proposal

Steven Schveighoffer schveiguy at yahoo.com
Thu Oct 23 07:04:43 PDT 2008


"Bill Baxter" wrote
> 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.

So does VB.  And I'm not too fond of it.  (actually, I'm not fond of either 
VB or array indexing with parens, which is why I spent an entire day 
converting a VB project I had to work on to C#)

-Steve 





More information about the Digitalmars-d mailing list