Citizens of hubFS rejoice! The Toolmaker is back.
By on 6/16/2009 6:01 PM ()
found in f# source

ToolmakerSteve:

let inline retype (x:'a) : 'b = (# "" x : 'b #)

let inline MyAlg2 (n1:'a) (n2:'a) =

    ((n1 + n2) + (n1 + (retype MyConst : 'a)) + (n2 + (retype MyConst : 'a)))

(# #) allows to write inline IL
By on 10/29/2008 5:13 PM ()
just to gain some experience I typed this in

let MyConst = 123
let inline retype (x:'a) : 'b=(# "" x: 'b #)
let inline MyAlg2 (n1:'a) (n2:'a) =
      ((n1+n2)+(n1 + (retype MyConst:'a)) + (n2 + (retype MyConst:'a)))
printfn "??? %02d" (MyAlg2 1 2)      // ==> 252
printfn "!!! %5.2f" (MyAlg2 1. 2.)   // ==> 6.00

either the deprication of the construct if faulting the float sample to 6.00 instead of
252.00 or what? it now look retype evaluates floats to 0.0!?

Just trying to gain insight in the language
By on 6/18/2009 12:29 AM ()

(rereading some old posts)

FYI, in the latest release - 1.9.6.16:

> let inline retype (x:'a) : 'b = (# "" x : 'b #);;

  let inline retype (x:'a) : 'b = (# "" x : 'b #);;
  ---------------------------------^^^^^^^^^^^^^

C:\Users\James\AppData\Local\Temp\stdin(3,34): warning FS0042: This construct is deprecated: it is only for use in the F# library
By on 6/16/2009 4:04 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us
Built with WebSharper