Yes; the type is called "int64" and constant literals take the 'L' suffix. See

[link:research.microsoft.com]

and

[link:research.microsoft.com]

By on 10/1/2008 5:12 PM ()

Thanks for the heads up but it seems like you cannot provide a long/int64 type to a format string. You only have %d and %i to specify signed integers, and that yields the following

let s = sprintf "%d"
val s : int -> string

let s = sprintf "%i"

val s : int -> string

When I try to use the deprecated functionality %lu %ld it yields the following

let s = sprintf "%ld"

val s : int -> string

let s = sprintf "%lu"

val s : int -> string

Pretty much the only way I can get the function sprintf generates to be the right type is to specify the type information as follows.

let s : int64 -> string = sprintf "%i"

val s : (int64 -> string)

Is there any plans to implement the ability to explicitly specify type information along with the string format information, instead of having to explicitly state the type you want. I can see this getting pretty hairy when you have a large number of format specifiers in your string and only wanting a particular basic int type for one or two. You would be forced to hardcode ALL the types.

By on 10/2/2008 6:59 AM ()

Hi,

This is indeed overloaded. Usually, you don't need explicit annotations: the compiler can infer them from the context. If you call s with an int64, then it gets type int64 -> string.

If you tried in the interactive mode, you should send multiple delcarations at once.

let s = sprintf "%d"

let a = s 4L;;

val s : (int64 -> string)

val a : string

Laurent.

By on 10/2/2008 11:35 AM ()
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