Re: Bracket indexing

Peter Gummer <[email protected]> Sun, 27 Nov 2005 23:13:26 +1100
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Message-ID <[email protected]>
Roger Browne wrote:

>    orders.put_front(units.i_th(move_index).item)
>    orders.put_front(units[move_index].item)
>
> The first line works. You would think that the second line would work,
> but it is apparently parsed as
>
>    orders.put_front(units.i_th(move_index.item))
>
> And don't even think about multi-dimensional bracket indexing :-(
>
>> It's sad that SmartEiffel refuses to implement these improvements.
>
> Maybe one day, done properly, it will be worth doing.

Bracket notation is definitely worth doing today. Sure, the  
requirement for parentheses under some circumstances is clunky. At  
least three people have posted questions about it to the Eiffel  
Software mailing list. It reminds me of how Eiffel occasionally  
unexpectedly requires semicolons.

Bracket notation is imperfect, but it's an improvement on the old  
way. Now that was really clunky! I've met people who would refuse to  
use Eiffel because, instead of writing this:

	a_list [3] := a_list [3] + x

You had to use this unwieldy syntax:

	a_list.put (a_list.item (3) + x, 3)

There's no contest. The former is far more readable.

- Peter Gummer