mbuf has quit [Read error: Connection reset by peer]
mbuf has joined #ocaml
dump has joined #ocaml
def has joined #ocaml
tane_ has joined #ocaml
Haudegen has joined #ocaml
mfp has joined #ocaml
narimiran has quit [Ping timeout: 256 seconds]
chripell has joined #ocaml
chripell has quit [Ping timeout: 256 seconds]
mfp has quit [Remote host closed the connection]
mfp has joined #ocaml
jaar has joined #ocaml
chripell has joined #ocaml
chripell has quit [Ping timeout: 240 seconds]
narimiran has joined #ocaml
ggole has joined #ocaml
vicfred has quit [Quit: Leaving]
tane_ is now known as tane
chripell has joined #ocaml
chripell has quit [Ping timeout: 264 seconds]
chripell has joined #ocaml
TheLemonMan has joined #ocaml
chripell has quit [Ping timeout: 240 seconds]
vicfred has joined #ocaml
vicfred has quit [Quit: Leaving]
amiloradovsky has joined #ocaml
mbuf has quit [Quit: Leaving]
<Serpent7776>
why is format_of_string's signature format6 -> format6?
Jesin has quit [Quit: Leaving]
<def>
Serpent7776: format_of_string is just a convenience to make sure a string literal is typed as a format
<def>
if you do let x = "%d" in ..., x defaults to type string
<def>
rather you should do let x = format_of_string "%d" in ...
<def>
as far as I known, there is no way to dynamically check a format type.
<Serpent7776>
so where does the actual conversion take place? before format_of_string? is it some compiler magic?
<def>
it is compiler magic.
<Serpent7776>
ah
<def>
it is done by the typechecker because it needs to check that the format string conforms to the arguments
<Serpent7776>
so format_of_string just invokes that compiler magic?
<def>
[format_of_string e] does nothing more than (e : _ format6)
<def>
(the format string is actually a value of an internal gadt and you can build values of that type so in theory it is possible to implement a dynamic format checker at runtime)
<Serpent7776>
so this function does nothing at runtime? wholo conversion takes place at compilation time?
<def>
yes
<Serpent7776>
ok, thanks for clarification, it's kinda surprising at first
Jesin has joined #ocaml
<def>
("%s" : _ format) is a convenient syntax for something that looks like CamlinternalFormatBasics.(Int (Int_d, No_padding, No_precision, End_of_format))
<def>
it looks like a string in the source but beside that, it doesn't have much to do with a string.
<def>
(Older versions of OCaml would parse the format twice: first at compile time to check types, then at runtime to interpret the format, this was buggy)
<Serpent7776>
oh, I didn't know _ can be used as type parameter placeholder
narimiran has quit [Quit: leaving]
Anarchos has joined #ocaml
dump has quit [Quit: Leaving]
inkbottle has joined #ocaml
zebrag has quit [Ping timeout: 265 seconds]
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]