adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.06.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.06/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
pmetzger_ has joined #ocaml
pmetzger has quit [Read error: Connection reset by peer]
pmetzger_ has quit [Client Quit]
kakadu has quit [Remote host closed the connection]
<orbifx[m]> kerrhau: there is
malc_ has quit [Ping timeout: 240 seconds]
kerrhau has joined #ocaml
nomicflux has quit [Quit: nomicflux]
nomicflux has joined #ocaml
nomicflux has quit [Client Quit]
zolk3ri has quit [Quit: leaving]
snhmib has quit [Ping timeout: 260 seconds]
<hooman> ouu nice link =)
p1n34ppl3 has joined #ocaml
Algebr has joined #ocaml
_andre has quit [Ping timeout: 240 seconds]
p1n34ppl3 has quit [Remote host closed the connection]
Algebr has quit [Remote host closed the connection]
ziyourenxiang has quit [Ping timeout: 255 seconds]
enterprisey has joined #ocaml
silver has quit [Read error: Connection reset by peer]
nomicflux has joined #ocaml
cobreadmonster has joined #ocaml
mfp has quit [Ping timeout: 250 seconds]
emliunix has joined #ocaml
emliunix has quit [Quit: No Ping reply in 180 seconds.]
_whitelogger has quit [Ping timeout: 250 seconds]
_whitelogger has joined #ocaml
losira has joined #ocaml
_andre has joined #ocaml
cbot_ has joined #ocaml
cbot has quit [Ping timeout: 248 seconds]
jbrown has quit [Ping timeout: 268 seconds]
shinnya has joined #ocaml
alexelcu has quit [Quit: The Lounge - https://thelounge.github.io]
alexelcu has joined #ocaml
<hooman> what the
nomicflux has quit [Quit: nomicflux]
<losira> is that the future
govg has joined #ocaml
<hooman> there is built in lisp and scheme syntax as well, which actually seem quite useful
<losira> that's cool
<hooman> yeah.. some parts of revised syntax i really like. i wonder if i could pick and choose ..
<losira> you could probably start with the normal syntax and replace it with parts from the revised syntax
<hooman> ah interesting.. there are also built in tools for converting back and forth as well
spew has joined #ocaml
losira has left #ocaml [#ocaml]
ziyourenxiang has joined #ocaml
FreeBirdLjj has joined #ocaml
cobreadmonster has quit [Quit: Connection closed for inactivity]
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0_ has joined #ocaml
infinity0 is now known as Guest29715
Guest29715 has quit [Ping timeout: 268 seconds]
spew has quit [Ping timeout: 248 seconds]
spew has joined #ocaml
spew has quit [Read error: Connection reset by peer]
malina has quit [Quit: Throwing apples of Montserrat]
cbot_ has quit [Quit: Leaving]
am2904 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
slash^ has joined #ocaml
kerrhau has quit [Ping timeout: 268 seconds]
malc_ has joined #ocaml
argent_smith has joined #ocaml
enterprisey has quit [Remote host closed the connection]
argent_smith has quit [Quit: Leaving.]
am2904 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kakadu has joined #ocaml
jnavila has joined #ocaml
jnavila has quit [Ping timeout: 240 seconds]
jnavila has joined #ocaml
TarVanimelde has joined #ocaml
dmi3y has joined #ocaml
jnavila has quit [Ping timeout: 248 seconds]
jnavila has joined #ocaml
am2904 has joined #ocaml
am2904 has quit [Client Quit]
am2904 has joined #ocaml
dmi3y has quit [Quit: dmi3y]
Hetu has joined #ocaml
dmi3y has joined #ocaml
am2904 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
am2904 has joined #ocaml
am2904 has quit [Client Quit]
am2904 has joined #ocaml
am2904 has quit [Client Quit]
am2904 has joined #ocaml
am2904 has quit [Client Quit]
TarVanimelde has quit [Quit: TarVanimelde]
jnavila has quit [Ping timeout: 240 seconds]
dmi3y has quit [Quit: dmi3y]
ygrek_ has joined #ocaml
ome has quit [Quit: Connection closed for inactivity]
shinnya has quit [Ping timeout: 248 seconds]
demonimin has quit [Ping timeout: 248 seconds]
mfp has joined #ocaml
zolk3ri has joined #ocaml
demonimin has joined #ocaml
demonimin has joined #ocaml
silver has joined #ocaml
<Drup> hooman: this is as much the future as a fallout video game.
FreeBirdLjj has joined #ocaml
jnavila has joined #ocaml
argent_smith has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
Anarchos has joined #ocaml
barcabuona has joined #ocaml
sgnb has quit [Ping timeout: 268 seconds]
nomicflux has joined #ocaml
Hetu has quit [Quit: Verlassend]
Anarchos has quit [Quit: Vision[0.10.2]: i've been blurred!]
ShalokShalom has joined #ocaml
Anarchos has joined #ocaml
jnavila has quit [Ping timeout: 240 seconds]
dmi3y has joined #ocaml
ygrek_ has quit [Ping timeout: 248 seconds]
argent_smith1 has joined #ocaml
argent_smith has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
barcabuona has quit [Quit: WeeChat 1.9.1]
wklm has joined #ocaml
spew has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
wklm has quit [Ping timeout: 248 seconds]
spew has quit [Read error: Connection reset by peer]
wklm has joined #ocaml
spew has joined #ocaml
chetshah has joined #ocaml
<chetshah> Hi all, ocaml beginner here, was wondering that one cannot make a record without declaring its type first?
kolko has joined #ocaml
spew has quit [Ping timeout: 240 seconds]
<chetshah> I was going through some programming languages lectures that use smlnj and it is allowed to make records before declaring type first. Where can I know more about this?
<Anarchos> chetshah yes you can
<chetshah> let k = { name="chet"; age=40 };; gives unbound record field name.
<chetshah> if I have not declared a record type with fields name and age.
Anarchos has quit [Ping timeout: 268 seconds]
jmiven has quit [Quit: co'o]
jmiven has joined #ocaml
govg has quit [Ping timeout: 248 seconds]
jnavila has joined #ocaml
jbrown has joined #ocaml
sailorswift has joined #ocaml
sailorswift has quit [Remote host closed the connection]
<def`> chetshah: in OCaml you have to predeclare records
<def`> you can work around by using objects: let k = object method name = "chet" method age = 40 end;; but it is a bit more verbose :)
<chetshah> def` got it! Thanks
barcabuona has joined #ocaml
dmi3y has quit [Quit: dmi3y]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
Fistine has quit [Ping timeout: 255 seconds]
Fardale has quit [Ping timeout: 240 seconds]
Anarchos has joined #ocaml
tobiasBora has quit [Ping timeout: 264 seconds]
FreeBirdLjj has quit [Ping timeout: 260 seconds]
jbrown has quit [Ping timeout: 240 seconds]
Anarchos has quit [Ping timeout: 240 seconds]
wklm has quit [Ping timeout: 268 seconds]
chetshah has quit [Quit: Page closed]
sz0 has joined #ocaml
spew has joined #ocaml
barcabuona has quit [Quit: WeeChat 1.9.1]
argent_smith has joined #ocaml
argent_smith1 has quit [Ping timeout: 248 seconds]
jimt_ has joined #ocaml
jimt has quit [Ping timeout: 248 seconds]
nomicflux has quit [Quit: nomicflux]
zmt00 has joined #ocaml
spew has quit [Ping timeout: 240 seconds]
kerrhau has joined #ocaml
barcabuona has joined #ocaml
moei has quit [Read error: Connection reset by peer]
moei has joined #ocaml
<andreas___> Can anyone help explain why use of a mutable field leads to loss of generality in this example? https://gist.github.com/andreas/ee2fc584996ec7b10e9baab4eb513d53
zolk3ri has quit [Ping timeout: 248 seconds]
spew has joined #ocaml
<lyxia> andreas___: if it were allowed, you could write this: some_foo.f <- (fun x -> x + 1) ; some_foo.f "ocaml"; (where some_foo gets specialized as int foo then string foo)
spew has quit [Read error: Connection reset by peer]
<lyxia> oh wait f is not mutable
<andreas___> lyxia: yeah, only x is mutable and is not used in f..
<lyxia> oh well, the value restriction is meant to prevent these kinds of cases I mentioned, and perhaps it's not worth the trouble to do it in a too fine grained way.
<andreas___> That's a shame... though it seems like it's a silly example, I have some code quite like it :)
moei has quit [Read error: Connection reset by peer]
<malc_> andreas___: curiously enough "x : string ref" is accepted
<andreas___> malc_: hmm, I get the same error with string ref.
<andreas___> on 4.04.2
<malc_> 4.06
<malc_> type 'a foo = Foo : {
<malc_> f : 'a -> int;
<malc_> x : string ref;
<malc_> } -> 'a foo
<malc_>
<malc_> let some_foo = Foo {
<malc_> f = (fun _ -> 1);
<malc_> x = ref "";
<malc_> }
<malc_> ;;
<malc_> type 'a foo = Foo : { f : 'a -> int; x : string ref; } -> 'a foo
Anarchos has joined #ocaml
<malc_> val some_foo : '_weak1 foo = Foo {f = <fun>; x = {contents = ""}}
<malc_>
<andreas___> It looks like it's missing the forall-annotation on some_foo though: let some_foo : 'a. 'a foo = ...
<octachron> malc_, the weakly polymrophic type variable `_weak1` shows that the value restriction has biten
<malc_> octachron: original variant uses _weak4 whatever that means
<malc_> uses === results in
<octachron> however, it is indeed sort of possible to avoid the value restriction with a string ref: let x = ref ""; let foo = { f=(fun _ -> 1); x } works (for some values of "works")
<lyxia> oh that's neat
<lyxia> malc_: the point is not to get the underscore in front.
<octachron> malc_, "_weak${n}" means the n-th weakly polymorphic type variable introduced in the typing environment
<malc_> andreas___: yeah, fails with forall annotation
<octachron> weakly polymorphic type variable are a form of "placeholder" types for a concrete but unknown at the moment type
<andreas___> octachron: that workaround might actually do the trick in my case -- thanks! Trying it out now..
<lyxia> malc_: try let Foo a = some_foo in a.f 0;; then ask for the type of some_foo again. "int foo".
wklm has joined #ocaml
<octachron> andreas___, another option when tiptoeing around the value restriction is to hid the value behind a function call "let foo () = Foo …"
<andreas___> octachron: thanks. Extracting to a separate let worked this time around. Can you explain why makes a difference?
<M-ErkkiSeppl> andreas___: polymorphic values can be unsafe in the presence of mutation, and there's a simple syntactic method to ensure that the unsafe cases are impossible
<M-ErkkiSeppl> in this case it's always safe to have a function return a polymorphic instance, because it creates a new one instead of referring to an old one
am2904 has joined #ocaml
<andreas___> That makes sense. It refers to the "hiding behind function call"-workaround, right? How about the other workaround using a ref: `let x = ref ""; let foo = { f=(fun _ -> 1); x } `
AlexRussia has quit [Ping timeout: 240 seconds]
zolk3ri has joined #ocaml
AlexRussia has joined #ocaml
AlexRussia has quit [Client Quit]
am2904 has quit [Read error: Connection reset by peer]
clockish has quit [Ping timeout: 240 seconds]
clockish has joined #ocaml
Fardale has joined #ocaml
<octachron> andreas___, basically the value restriction is syntactic by nature; it restricts polymorphism to value; with a restrictive definition of what is a value
<octachron> in particular, a record with a mutable field is not considered as a value, neither is the result of a function call
<octachron> so in `{ f = (fun _ -> 1); x = ref "" }` the value restriction sees a function call ref "", so no polymorphism allowed`
<octachron> similarly with `{ f = (fun _ -> 1); x = { contents = ""} }`, contents is a mutable field, so still no polymorphism
TarVanimelde has joined #ocaml
<octachron> but with `let x = ref "" let foo = { f=…; x }`, the first let defines a string ref; so the value restriction is not allowed
<octachron> and in the second let, we are building a record with no mutable fiels , from two values f=(fun _ -> ), (functions are always considered a value)
<octachron> and x, which is already constructed value; so the value restriction does not trigger
<octachron> and the type of foo can be generalized safely
<octachron> *a string ref, … so the value is not allowed → a string ref, so the value restriction is not problematic
<hooman> hm thats a strange special case
argent_smith1 has joined #ocaml
argent_smith has quit [Ping timeout: 248 seconds]
jbrown has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
TarVanimelde has quit [Quit: TarVanimelde]
<octachron> hooman, in which way is it a special case? It is more a consequence of application of very generic and broad rules that leads to a not so obvious consequence
<octachron> and this is quite far from Banach-Tarski level of unintended consequence
sh0t has joined #ocaml
<hooman> hm thats true
<andreas___> octachron: thanks for the elaborate explanation. Any good sources for reading further up on this?
<octachron> but I fear that the finer details are not covered
jnavila has quit [Ping timeout: 240 seconds]
mal`` has quit [Quit: Leaving]
mal`` has joined #ocaml
mal`` has quit [Remote host closed the connection]
kalio has quit [Quit: WeeChat 1.9.1]
mal`` has joined #ocaml
Anarchos has quit [Remote host closed the connection]
jnavila has joined #ocaml
Anarchos has joined #ocaml
Jesin has joined #ocaml
kalio has joined #ocaml
jnavila has quit [Remote host closed the connection]
Soni is now known as SoniIsAThey
moei has joined #ocaml
zolk3ri has quit [Remote host closed the connection]
wklm has quit [Read error: Connection reset by peer]
sh0t has quit [Remote host closed the connection]
sh0t has joined #ocaml
p1n34ppl3 has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.2]: i've been blurred!]
mengu has quit [Remote host closed the connection]
ziyourenxiang has quit [Ping timeout: 248 seconds]
barcabuona has quit [Ping timeout: 258 seconds]
cbot has joined #ocaml
pierpa has joined #ocaml
webshinra has quit [Remote host closed the connection]
webshinra has joined #ocaml
kakadu has quit [Remote host closed the connection]
snhmib has joined #ocaml
Jesin has quit [Quit: Leaving]
spew has joined #ocaml
jbrown has quit [Ping timeout: 248 seconds]