adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.09 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
nullcone has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
zmt01 has joined #ocaml
zmt00 has quit [Ping timeout: 260 seconds]
jaar has quit [Ping timeout: 256 seconds]
ygrek has quit [Ping timeout: 240 seconds]
amiloradovsky has quit [Ping timeout: 260 seconds]
mfp has quit [Ping timeout: 264 seconds]
h11 has quit [Quit: The Lounge - https://thelounge.chat]
zebrag has joined #ocaml
inkbottle has quit [Ping timeout: 256 seconds]
narimiran has joined #ocaml
mbuf has joined #ocaml
wingsorc has quit [Quit: Leaving]
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!]
vicfred has joined #ocaml
<octachron> Serpent7776, note that there is a limited form of dynamical checking of format string in https://ocaml.org/releases/4.10/htmlman/libref/Scanf.html#VALformat_from_string
<Serpent7776> does that function check that given string yields exactly given format type? Can't think of use case for that.
ggole has quit [Quit: Leaving]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
tane has quit [Quit: Leaving]
nicooo has quit [Remote host closed the connection]
nicooo has joined #ocaml