<companion_cube>
I think that's partly why I don't like much code generation
<companion_cube>
it doesn't mix well with libraries, and is too "magic"
zpe has joined #ocaml
<flux>
but for stuff like serialization it can be nice, it reduces duplication
tulloch has joined #ocaml
rwmjones has quit [Read error: Operation timed out]
avsm has joined #ocaml
ontologiae has quit [Ping timeout: 265 seconds]
<companion_cube>
yeah...
<companion_cube>
no silver bullet for this, imho
<companion_cube>
unless ocaml-ty is merged into the trunk
yacks has joined #ocaml
jonludlam has joined #ocaml
nikki93 has joined #ocaml
demonimin has quit [Ping timeout: 245 seconds]
<adrien_oww>
I find code generation too difficult to do properly
<adrien_oww>
it's more difficult to reason about
<adrien_oww>
you can't just look at a data structure and write your code to do stuff
<adrien_oww>
you need to look at the data structure and write code that will write code that does stuff
<ousado>
yes, but it's very effective
<adrien_oww>
I don't think so
<adrien_oww>
sexplib is very inefficient for instance
<adrien_oww>
or at least it was one to two years ago
<adrien_oww>
and code is duplicated everywhere
demonimin has joined #ocaml
<ousado>
that entirely depends on the quality of the code generator
<adrien_oww>
my belief is that the added difficulty in writing the code and code generator makes it difficult to do something of quality
rwmjones has joined #ocaml
<flux>
so you view the value of code generation in the quality of the code it generates?
<flux>
I view the value as the service it provides
<ousado>
adrien_oww: I don't understand how that's different from hand-written code
csakatoku has quit [Remote host closed the connection]
<flux>
I used sexp as a protocol between different OCaml processes and it was quite nice to change the protocol in sync.
<flux>
you need to pass a new field? just add a new field and it works.
nikki93 has quit [Ping timeout: 244 seconds]
boogie has joined #ocaml
<flux>
of course, if you need to consider protocol versioning and multiple implementations, it becomes more difficult
<flux>
but maybe protobuf works in that case, and it's based on code generation as well..
<flux>
(well, there are implementations that provide code generation that is)
<ousado>
done correctly it will save hours and hours of time, and when there's a bug, you fix it once for all code being generated, that's what I mean with "effective"
<flux>
when you are writing the dozenth straight-forward implementation of converting a record to a protocol message and vice versa, you start to think that there's gotta be a better way.
<flux>
not to mention how easily people makes mistakes in tasks computers should do ;)
<ousado>
indeed
<adrien_oww>
ousado: ah
<adrien_oww>
ousado: I was not advocating looking at your types and writing it by hand each and every time
<adrien_oww>
(*)
<adrien_oww>
I had runtime types in mind
boogie has quit [Ping timeout: 240 seconds]
<companion_cube>
I'm more in favor of combinators when it's humanly tractable
<companion_cube>
but it's a bit more efforts than code generation, for sure
<flux>
I guess proper runtime type information would be a decent solution, better than Marshal anyway
tulloch_ has joined #ocaml
<companion_cube>
(excepted that compiling is simpler)
<adrien_oww>
(*) note that I've done the hand-writing part for yypkg
<flux>
you could just auto generate those uses of combinators! :-)
<adrien_oww>
basically I removed the sexplib code generation
<adrien_oww>
factored the code
<adrien_oww>
now the code to handle a record is very very dumb and simple
<adrien_oww>
and I update by hand but it's difficult to make a mistake
<ousado>
for my part, I like the idea that the generated code is being statically checked by the compiler, like everything else, too
<adrien_oww>
with runtime types you still have the safety
<adrien_oww>
it goes through GADTs but that's it
<companion_cube>
flux: you could generate the use of combinators, indeed
mort___ has joined #ocaml
ontologiae has joined #ocaml
ollehar has joined #ocaml
csakatoku has joined #ocaml
rand000 has quit [Ping timeout: 240 seconds]
csakatoku has quit [Remote host closed the connection]
talzeus has quit [Remote host closed the connection]
johnelse_away is now known as johnelse
arjunguha has joined #ocaml
wombat1 has joined #ocaml
tulloch has quit [Read error: Operation timed out]
tulloch_ has quit [Ping timeout: 240 seconds]
rwmjones_ has joined #ocaml
rwmjones has quit [Quit: Terminated with extreme prejudice - dircproxy 1.2.0]
rwmjones_ is now known as rwmjones
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rom1504 has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
_andre has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
wombat1 has quit [Ping timeout: 240 seconds]
nikki93 has joined #ocaml
tulloch has joined #ocaml
tulloch_ has joined #ocaml
boogie has joined #ocaml
nikki93 has quit [Ping timeout: 240 seconds]
rwmjones has quit [Ping timeout: 245 seconds]
rwmjones has joined #ocaml
boogie has quit [Ping timeout: 240 seconds]
tulloch_ has quit [Ping timeout: 264 seconds]
tulloch has quit [Ping timeout: 265 seconds]
tulloch has joined #ocaml
tulloch_ has joined #ocaml
tulloch_ has quit [Quit: leaving]
ygrek_ has quit [Ping timeout: 240 seconds]
arjunguha has joined #ocaml
wwilly has joined #ocaml
yacks has quit [Ping timeout: 240 seconds]
introom has joined #ocaml
wombat1 has joined #ocaml
rand000 has joined #ocaml
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
siddharthv is now known as siddharthv_away
ollehar has quit [Ping timeout: 240 seconds]
avsm has quit [Quit: Leaving.]
tulloch has quit [Ping timeout: 240 seconds]
yacks has joined #ocaml
ollehar has joined #ocaml
nikki93 has joined #ocaml
csakatoku has joined #ocaml
boogie has joined #ocaml
dsheets has joined #ocaml
tulloch has joined #ocaml
nikki93 has quit [Ping timeout: 265 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
boogie has quit [Ping timeout: 244 seconds]
wombat1 has quit [Ping timeout: 240 seconds]
tulloch has quit [Ping timeout: 240 seconds]
metasyntax has quit [Quit: Leaving]
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
csakatoku has quit [Ping timeout: 240 seconds]
arjunguha has joined #ocaml
gasche_ is now known as gasche
arjunguha has quit [Client Quit]
paolooo has quit [Ping timeout: 245 seconds]
boogie has joined #ocaml
boogie has quit [Ping timeout: 265 seconds]
saml has joined #ocaml
segimondu is now known as segmond
csakatoku has joined #ocaml
mort___ has quit [Ping timeout: 240 seconds]
wombat1 has joined #ocaml
divyanshu has quit [Quit: Computer has gone to sleep.]
darkf has quit [Quit: Leaving]
divyanshu has joined #ocaml
divyanshu has quit [Client Quit]
yacks has quit [Remote host closed the connection]
divyanshu has joined #ocaml
nikki93 has joined #ocaml
talzeus has joined #ocaml
talzeus has quit [Remote host closed the connection]
talzeus has joined #ocaml
freling has quit [Ping timeout: 240 seconds]
wombat1 has quit [Ping timeout: 264 seconds]
wombat1 has joined #ocaml
zpe has joined #ocaml
csakatoku has quit [Remote host closed the connection]
nikki93 has quit [Remote host closed the connection]
64MAAKA2Q has joined #ocaml
64MAAKA2Q has quit [Read error: Connection reset by peer]
introom has quit [Quit: WeeChat 0.4.3]
introom has joined #ocaml
introom has quit [Client Quit]
yacks has joined #ocaml
introom has joined #ocaml
maattdd has quit [Quit: WeeChat 0.4.3]
Muzer has joined #ocaml
nikki93 has joined #ocaml
dsheets has quit [Excess Flood]
dsheets has joined #ocaml
madroach has joined #ocaml
nikki93 has quit [Ping timeout: 244 seconds]
avsm has joined #ocaml
csakatoku has quit [Remote host closed the connection]
travisbrady has joined #ocaml
boogie has joined #ocaml
maattdd_ has quit [Quit: WeeChat 0.4.3]
csakatoku has joined #ocaml
shinnya has joined #ocaml
maattdd has joined #ocaml
csakatoku has quit [Remote host closed the connection]
mort___ has joined #ocaml
boogie has quit [Remote host closed the connection]
Sim_n has joined #ocaml
Simn|gone has quit [Ping timeout: 245 seconds]
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wombat1 has joined #ocaml
tlockney_away is now known as tlockney
jwatzman|work has joined #ocaml
ontologiae has joined #ocaml
S11001001 has joined #ocaml
S11001001 has quit [Changing host]
S11001001 has joined #ocaml
yacks has quit [Read error: Connection reset by peer]
nlucaroni has quit [Quit: leaving]
boogie has joined #ocaml
Sim_n has quit [Ping timeout: 245 seconds]
boogie has quit [Ping timeout: 244 seconds]
ollehar1 has quit [Ping timeout: 240 seconds]
introom has quit [Ping timeout: 252 seconds]
Simn has joined #ocaml
dsheets has quit [Ping timeout: 244 seconds]
lostcuaz has joined #ocaml
lostcuaz_ has joined #ocaml
lostcuaz has quit [Ping timeout: 265 seconds]
nikki93 has joined #ocaml
boogie has joined #ocaml
nikki93 has quit [Remote host closed the connection]
nikki93 has joined #ocaml
nikki93 has quit [Ping timeout: 244 seconds]
nikki93 has joined #ocaml
wolfnn has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
tlockney is now known as tlockney_away
mort___ has left #ocaml []
paolooo has joined #ocaml
mrGeppetto has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
peter` has joined #ocaml
peter` has quit [Remote host closed the connection]
mrGeppetto has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
mrGeppetto has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
ygrek_ has quit [Ping timeout: 244 seconds]
mrGeppetto has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
MisterGeppetto has joined #ocaml
introom has joined #ocaml
pyon has quit [Quit: restart]
dsheets has joined #ocaml
michael_lee has quit [Remote host closed the connection]
madroach has quit [Quit: leaving]
pyon has joined #ocaml
divyanshu has joined #ocaml
tlockney_away is now known as tlockney
nikki93 has quit [Remote host closed the connection]
wwilly has quit [Ping timeout: 244 seconds]
paolooo has quit [Ping timeout: 245 seconds]
RMacy has joined #ocaml
kagebe has joined #ocaml
<kagebe>
Hi everyone, I have a question regarding classes and their methods in OCaml: Can I get a function from a class method, i.e. reference the method of class such that I could apply it to an object of the class with the usual function syntax? (class.method) obj param1 ... obviously does not work
<kagebe>
or would I need to extract the method to a function outside the class somewhere first?
<ggole>
methods are functions, but they close over the object iirc
<ggole>
So if you have class wat = object method foo x:int = x end, (new wat)#foo will give you an ordinary function of type int -> int
<companion_cube>
they do
<companion_cube>
let foo = (fun o -> o#foo) should work though
<kagebe>
ah
<kagebe>
yes, I guess
<kagebe>
but there is no builtin syntax to get a lambda with that semantics, I gather?
<ggole>
(fun o -> o#foo) obj arg instead of obj#foo arg is a bit strange
<kagebe>
but sometimes useful, if you pass around this function
<Drup>
kagebe: no shortcut, no
ulfdoz has joined #ocaml
<kagebe>
in my case I (currently) have a class whose objects I want to test for equality in an oUnit test case, so I needed to pass an equality and printer function to assert_equal
<companion_cube>
ggole: not if you want this particular function
<ggole>
You mean, like let f accessor = accessor obj zonk?
<kagebe>
and if those are only defined within the class...
<companion_cube>
you mean the methods are private?
RMacy is now known as RMacy|Away
RMacy|Away has quit []
<kagebe>
no, but I don't have an object on which to call them, i.e. assert_equal ~cmp:(fun o1 o2 -> o1#equal o2)
<kagebe>
so I would need to build that lambda/extract the method from the class in this way
<kagebe>
or simply don't use a class in the first place
<Drup>
just use the lambda as you typed it
<Drup>
it's not short, but it works
<ggole>
Can classes mutually recurse?
<kagebe>
true, but I think I'll just get rid of the class, extract the methods to a module and the state to a type
Arsenik has joined #ocaml
johnelse is now known as johnelse_away
avsm has quit [Quit: Leaving.]
RMacy has joined #ocaml
introom has quit [Ping timeout: 244 seconds]
mort___ has joined #ocaml
nikki93 has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
jwatzman|work has joined #ocaml
jonludlam has quit [Remote host closed the connection]
angerman has quit [Ping timeout: 240 seconds]
mort___ has quit [Quit: Leaving.]
AltGr has left #ocaml []
sw1nn has quit [Ping timeout: 240 seconds]
kagebe has quit [Ping timeout: 265 seconds]
ikaros has quit [Quit: Ex-Chat]
axiles has quit [Quit: Quitte]
nikki93 has quit [Remote host closed the connection]
claudiuc has quit [Remote host closed the connection]
dsheets has quit [Read error: Operation timed out]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
struktured has joined #ocaml
xianxu has joined #ocaml
RMacy is now known as RMacy|Away
RMacy|Away has quit []
RMacy has joined #ocaml
avsm has joined #ocaml
q66 has joined #ocaml
<pippijn>
I want to install some data files along with my ocamlfind package. now how do I find those back at runtime?
axiles has joined #ocaml
<adrien>
you store the path?
<pippijn>
into the binary?
<adrien>
for instance
<pippijn>
hm, ok
<pippijn>
so I need to generate a file containing the installation path
<adrien>
I don't really like that but there aren't many alternatives
angerman has joined #ocaml
<pippijn>
can ocamlfind tell me where it would be installing my package, if I were going to install it?
<pippijn>
or just tell me the libdir
<adrien>
it can tell you the one that is currently in effect
<adrien>
might not be the one you're after
<pippijn>
I guess it'll do for now
<pippijn>
ah yes, destdir
jonludlam has joined #ocaml
Hannibal_Smith has joined #ocaml
<ggole>
Why not store the relative path?
<adrien>
you could store the various values defined at compile-time
<adrien>
if a resource cannot be found
<adrien>
try to make things relative
claudiuc has joined #ocaml
dsheets has joined #ocaml
tane has joined #ocaml
xianxu has quit [Ping timeout: 264 seconds]
avsm has quit [Quit: Leaving.]
MisterGeppetto has quit [Ping timeout: 265 seconds]
nikki93 has joined #ocaml
lostcuaz_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arj has joined #ocaml
nikki93 has quit [Ping timeout: 240 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
nikki93 has joined #ocaml
pyon has left #ocaml []
BitPuffin has joined #ocaml
ulfdoz has quit [Ping timeout: 244 seconds]
Puff has joined #ocaml
BitPuffin has quit [Read error: Connection reset by peer]
freemanv has joined #ocaml
_andre has quit [Quit: leaving]
ggole has quit []
angerman has quit [Quit: Gone]
hyperboreean has quit [Ping timeout: 264 seconds]
lostcuaz has joined #ocaml
lostcuaz has quit [Read error: Connection reset by peer]
lostcuaz has joined #ocaml
lostcuaz has quit [Client Quit]
lostcuaz has joined #ocaml
Puff has quit [Read error: Operation timed out]
ollehar has joined #ocaml
xianxu has joined #ocaml
freemanv has quit [Remote host closed the connection]
BitPuffin has joined #ocaml
avsm has joined #ocaml
tulloch has joined #ocaml
RMacy is now known as RMacy|Away
venk has joined #ocaml
RMacy|Away has quit []
venk` has joined #ocaml
tulloch has quit [Ping timeout: 240 seconds]
venk has quit [Ping timeout: 240 seconds]
<bernardofpc>
is menhir to ocamlyacc like bison to yacc ?
<pippijn>
bernardofpc: no
<pippijn>
bernardofpc: why do you ask?
tulloch has joined #ocaml
<companion_cube>
menhir is a better ocamlyacc
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BitPuffin has quit [Ping timeout: 244 seconds]
xianxu has quit [Ping timeout: 240 seconds]
<pippijn>
that is right
eni has joined #ocaml
<bernardofpc>
to know if it has features from bison