[Swift-devel] typecheck foo[*].bar

Ben Clifford benc at hawaga.org.uk
Sat Feb 14 08:16:11 CST 2009


I've implemented the below, as r2538.

On Tue, 10 Feb 2009, Ben Clifford wrote:

> I noticed today that expressions like this don't get typechecked properly, 
> so in 0.8, you can't use [*].member expressions. Bleugh.
> 
> As I want to use such expressions (or equivalent), I guess I have to fix 
> that soonish.
> 
> I think the approach I am favouring language-wise is that [*] becomes a 
> no-op/identity operator, and . with an array of structs on the left 
> returns an array of the appropriate member fields.
> 
> Thus   a[*] == a   for all arrays a
> 
>        a[*].foo == a.foo == (in haskelly pseudocode) (map \(x->x.foo) a)

-- 



More information about the Swift-devel mailing list