.net - Why does F# fail to support extending system type with its type abbreviation? -


for example, if try extend int, int not true name of type, code fail:

type int member this.iseven = % 2 = 0 

i must use system.int32 instead:

type system.int32 member this.iseven = % 2 = 0  //test let = 20 if i.iseven printfn "'%i' even" 

why can't use type abbreviation int?

i think will's glib answer right - features unimplemented default. however, possible reason type abbreviations scoped, it's not obvious whether scope of abbreviation should influence scope of extension. example:

module x =     type t = int  module y =     // imagine hypothetically     type x.t         member i.iseven = % 2 = 0  open y fun (x:system.int32) -> x.iseven // should compile though t isn't in scope here? 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -