views:

100

answers:

1

I have this code that does not compile anymore since I am on last F# CTP 1.9.7.8:

[<Struct>]
type MyStruct =
    val mutable private _i : int
    val mutable private _s : single
    val mutable private _i2 : int

    member t.I  = t._i
    member t.S  = t._s
    member t.I2 with get() = t._i2 * 2 and set(value) = t._i2 <- value * 2
    member t.Foo() = t._i * t._i

    [<ReflectedDefinition>] new (x, y, z) = {_i = x; _s = y; _i2 = z}

VS complains with this error message on the ReflectedDefinition attribute ahead of new: "This attribute is not valid for use on this language element"

It's very strange because for instance Tomas uses it extensively on constructors too in his F# Web Tools project. Is this now default behavior? (I've tried with VS2010 beta2 and I can repro). I don't see any alternative or possible workarounds.

In a same way, I can't put this attribute in front of members or properties (I don't know if it was possible with CTPs before 1.9.7.8). It works if I remove the Struct attribute (but still not on ctors) but I definitively need them on Struct (members and ctors).

Thanks

+3  A: 

This was a bug that is now fixed in our internal bits; in the next release ReflectedDefintion on constructors will work again. (Feel free to send such questions to [email protected].)

Brian
Ok, I will! Thanks!
Stringer Bell