Hide this comment

Hi Kurt -

The 4th Duck doesn't have any information to nail down the type of "a" to Speaker, as in the previous 3 examples. If you, for example, add a constraint to the constructor parameter "a : Speaker", then the code compiles. However, this may not be the solution you are looking for?

Luke

By on 9/21/2009 10:32 PM ()Reply
Hide this comment

Hi Luke,No, I was trying to make the ctor argument of type "has member speak", i.e. structural, not nominal,  but I see now that that is never the case, except for Duck1. I'm trying to get a feel for what the applications of these kind of constraints may be, in particular for duck typing or structural typing.Is the official recommendation still that these features are primarily for use in the F# libraries?thanks,Kurt

By on 9/21/2009 10:57 PM ()Reply
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper

Logging in...