pierpa has quit [Remote host closed the connection]
jao has quit [Ping timeout: 260 seconds]
wingsorc has joined #ocaml
wingsorc has quit [Quit: Leaving]
waleee-cl has quit [Quit: Connection closed for inactivity]
mbuf has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
narimiran has joined #ocaml
sgnb` has quit [Remote host closed the connection]
nicoo has quit [Ping timeout: 240 seconds]
nicoo has joined #ocaml
ggole has joined #ocaml
kvda has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nullcone has joined #ocaml
chripell has joined #ocaml
ggole has quit [Remote host closed the connection]
ggole has joined #ocaml
dborisog_ has quit [Ping timeout: 240 seconds]
ArthurStrong has joined #ocaml
copy has quit [Ping timeout: 246 seconds]
<Leonidas>
olle: `return`? As in a statement?
olle_ has joined #ocaml
ollehar_ has joined #ocaml
ggole has quit [Quit: Leaving]
ollehar_ has quit [Ping timeout: 258 seconds]
olle_ has quit [Ping timeout: 246 seconds]
olle_ has joined #ocaml
ollehar has joined #ocaml
dborisog_ has joined #ocaml
jbrown has joined #ocaml
smazga has quit [Ping timeout: 246 seconds]
bartholin has quit [Ping timeout: 258 seconds]
bartholin has joined #ocaml
<olle_>
monadic return syntax, like let* ?
<Armael>
what would the syntax be?
<def>
return :P
<Armael>
yeah :)
<olle_>
well, now it's return ()
<olle_>
hm
<olle_>
hard to make that shorter I admit
<Armael>
and it's just a normal function call, so no need for special syntax
<olle_>
booo
raver has quit [Ping timeout: 240 seconds]
mfp has joined #ocaml
<Leonidas>
`pure ()`
<Leonidas>
saved 2 characters
<olle_>
`()`
<olle_>
`_`
<olle_>
`:D`
clockish has quit [Ping timeout: 260 seconds]
copy has joined #ocaml
<dborisog_>
Do you know any good I/O or (basic) ETL library dealing with ADT <--> relational schema? I would imagine a star schema for a record-of-variants ADT.
<theblatte>
type t = { mutable n : int } let x = { n= 4 } in x.n <- 5; x.n
<Serpent7776>
Is that part of the language? Because When I try `(<-);;` in utop it says syntax error
<theblatte>
yes, just like (:=) will be a syntax error
<theblatte>
it's just not defined as an infix binary function
<theblatte>
well, I said that, but I'm wrong about (:=) ;)
<theblatte>
(:=);;
<theblatte>
- : 'a ref -> 'a -> unit = <fun>
<Serpent7776>
ok, thanks :)
<theblatte>
<- needs to operate on a field name though, which is not a valid OCaml value in itself, hence why it's not defined like that
<Serpent7776>
yeah, when I try `let x = 1; x <- 1` I got 'Error: The value x is not an instance variable'
Anarchos has joined #ocaml
clockish has joined #ocaml
raver has joined #ocaml
<octachron>
You can only mutate mutable fields of records (and mutable instance variable in classes). If you are learning OCaml, you should consider that every values is immutable at first.
<Anarchos>
octachron i wonder why record fiels have been made mutable and no other types of values
<def>
because values are immutable, and record fields are not values.
<Anarchos>
what are they ?
<def>
fields?
<octachron>
named offset in a memory block?
<Anarchos>
indeed i wonder why the ocaml decided to render only fields of record ad instance variabeles mutable
<theblatte>
also references
<theblatte>
(which are implemented as a mutable record field if I'm not mistaken)
<Leonidas>
theblatte: yeah, a ref is just a record with a mutable field, so it is purely syntactic sugar
<theblatte>
can you access the field? what's it called?
<octachron>
It is not even a syntactic sugar? `ref` is defined in the `Stdlib` module as an ordinary record.
<octachron>
contents
<theblatte>
you're right octachron, haha
<flux1>
I guess it would bring interesting things to think about, such as how pattern matching works, if values were mutable
<flux1>
you can of course pattern match a record, but then the binding is not mutable. should it be if the record field is mutable?
<flux1>
I think it should be the other way around (no mutable at all, only primitive "ref"), but in practice it can be nice at times, when copying records
<flux1>
..and of course, performance
<zozozo>
flux1: well, problems can arise if you pattern match a record (or something else that contain mutable parts), and also mutate it inside of a 'when' guard
<zozozo>
but mutating things in when guards when patter matching on them is more seen as a user error (reasonably, ^^)
<zozozo>
but, some other subtle operations allowed in patterns can have side-effects not visible to the user (i.e. pattern matching a float array, a lazy value, etc...)
Haudegen has joined #ocaml
<zozozo>
which interacts more or less well with the assumption of the pattern matching engine that *values* (so not mutable things) are pattern matched
<Leonidas>
zozozo: if someone submits me code where a guard starts mutating shit I'd get furious
<zozozo>
Leonidas: agreed
<zozozo>
that would juste be bad code
<zozozo>
but it's tecnically possible, and I don't recall the exact situatio of the compiler wrt to that currently (it might potentially cause segfaults in some cases I guess)
<Anarchos>
I build a bytecode with dune but ocamldebug crashes on it
zebrag has joined #ocaml
inkbottle has quit [Ping timeout: 246 seconds]
<flux1>
zozozo, it probably isn't a problem for compiler, because it doesn't do coverage analysis for 'when'
<flux1>
it's only a problem for the poor sap who needs to debug it :)
<flux1>
and, shortly after, to the person who wrote it