5 Comments

Hi, It seems that (Person “Yan Cui”) just calls the Person constructor and so the explicit op is never exercised in this example. I added a print to your code to check this https://gist.github.com/3324408

Do you know if there is some way to invoke op_Explicit in F# other than (Person.op_Explicit “Yan Cui”)? I tried (“yan Cui” :> Person) but the compiler doesn’t like that.

Best, Keith

theburningmonk • Author

Hi Keith, thank you very much for pointing that out! I’ve reworked the example, but haven’t found a way to invoke op_Explicit beyond Person.op_Explicit, if you happen to stumble across a way to do it then please do let me know!

Andrew •

When were these introduced? They kinda remind me of Scala’s
object Person { def apply(name: String) = new Person(name) }
…but slightly uglier. Still, these could come in handy, thanks for posting!

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.