Nominal subtyping is used. But that's not the entire story

  • If you're really keen to access arbitrary properties and methods in a dynamic "duck typing" style then you can do it via reflection (this can be made reasonably efficient if you work hard).
  • Operator overloading is resolved via a statically-resolved form of structural subtyping

Cheers!

don

By on 11/21/2006 4:12 PM ()

Nominal subtyping is used. But that's not the entire story

  • If you're really keen to access arbitrary properties and methods in a dynamic "duck typing" style then you can do it via reflection (this can be made reasonably efficient if you work hard).
  • Operator overloading is resolved via a statically-resolved form of structural subtyping

Cheers!

don

Are there any plans to bring structural subtyping into f# or will this remain a divergence from ocaml? I understand that for externally visible methods, the clr kind of forces you into nominal typing, but for internal-only methods this would be a welcome addition. It seems like the reflection approach is how you'd have to implement it anyway, so even if that was exposed as "object" to the outside world and documented somehow it would be nice.

I don't know enough about the generics implemention to know if it would even be possible to lobby the clr group for more finely grained constraints at that level either. :)

By on 11/22/2006 6:28 AM ()

Hi again,

We'd probably not add OCaml-style structural subtyping, instead we'd be more inclined to augment what we have with type-classes of some kind, where type-class constraints could include object members. We talk about it often but haven't made any decisions yet, if we'll do anything at all

cheers!

don

By on 11/23/2006 11:25 PM ()
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