Re: [Vala] Feature request: Syntactic sugar to map foo[index] to foo.get(index)



Jürg Billeter wrote:
Hi,

On Mon, 2010-03-01 at 03:31 -0600, Sandino Flores Moreno wrote:
I noticed that Vala allows with Gee sequences the next mapping:
    array_list[index]    --->     array_list.get(index)

However, shouldn't it be possible in non-gee objects?

This is already the case, there is nothing Gee-specific in the compiler
(with the exception of the Genie parser).

Jürg

Can you give us a list of the compile-time "duck typing" protocols?

 Iterator<T> iterator ()        -> 'foreach'
 T? next_value ()               -> alternative 'foreach' iterator protocol

 T get (int index)              -> indexer access ('[index]')
 void set (int index, T item)

 bool contains (T needle)       -> 'in' operator

 T slice (long start, long end) -> slicing ('[start:end]')

 string to_string ()            -> string templates

Am I missing something?


Best Regards,

Frederik



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]