<ingsoc>
open Msgpack_convtype t = { int : int; str : string; } with conv(msgpack)(* serialize *) let bytes = Msgpack.Serialize.serialize_string (msgpack_of_t { int = 42; str = "ans" })(* deserialize *) let obj = t_of_msgpack (Msgpack.Serialize.deserialize_string bytes)
<ingsoc>
things like
<ingsoc>
type t = { int : int; str : string; } with conv(msgpack)
<ingsoc>
what is the "with" doing
<def`>
it's a syntax extension
<def`>
a camlp4 one, so the semantics of this with depends on the library
<ingsoc>
ok, i see, so it is like a macro
<def`>
yes
<ingsoc>
in something like lisp
<ingsoc>
ok, hmmmm
<ingsoc>
things can get confusing
<ingsoc>
why would they do that
<def`>
likely it produces functions to convert to and from msgpack
<def`>
because that's useful/practical?
<ingsoc>
OK, well I guess that kind of thing may be pretty common in ocaml world
<def`>
Nowadays it standardized around ppx
<def`>
There are two technologies for that kind of extensions:
<def`>
camlp4, which extends syntax
<def`>
ppx, which use existing syntax and allow to custom programs to rewrite part of it
<ingsoc>
Are there any community kind of best practices on when it is appropriate to add to the syntax to solve a problem rather than just use built in stuff
<def`>
Basically when you need to operate at a meta level.
<ingsoc>
def`: could you point me to a simple example of using such tools to extend and when/why you would do it
<ingsoc>
?
<def`>
Here the functions to go to/from msgpack to t need to know the definition of t
<ingsoc>
well, you have alluded to the why
<def`>
I don't know good ressources for that, surely someone will be able to help
<def`>
ingsoc: yep, you can't observe that kind of definition from the language itself
<def`>
so you really on external tools, operating at a meta-level, for that kind of boilerplate
<Algebr>
what kind of server crapped out on serving static pages
<MercurialAlchemi>
aah, maybe the server is in PHP?
<Algebr>
OCaml, the performant language whose website craps out after 2000 people go to the homepage.
Kakadu has joined #ocaml
ollehar has quit [Ping timeout: 256 seconds]
<MercurialAlchemi>
well, the typechecker doesn't check for runtime performance, now...
rgrinberg has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
ingsoc has quit [Ping timeout: 240 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
manuel_ has joined #ocaml
<dmbaturin>
Algebr: Also, the pile of static pages that is ocaml.org is supposedly hosted by rackspace.
<dmbaturin>
So I'm wondering what's the actual scope of this problem. May be far greater than just ocaml.org
<Drup>
dmbaturin: you are not doing this right ! you are not jumping to conclusions based on non existing proofs :D
<dmbaturin>
Drup: No, just making up hypotheses.
ollehar has joined #ocaml
<dmbaturin>
Also, I liked the glue used by ocaml.org enough to use it for my own website. :)
ingsoc has joined #ocaml
marsam has joined #ocaml
Lasher` has quit [Read error: Connection reset by peer]
<Algebr>
whatever the reason, the marketing message is bad.
<companion_cube>
tane: what do you mean? an abstraction over gen?
larhat1 has joined #ocaml
<tane>
companion_cube, some function like "iter" over gen. Use case: have a lazy iteration over the lines of a file from CCIO.gen
<tane>
but then, it's not too hard to write that myself :)
<companion_cube>
oh! yes indeed, it's in a small library called "gen" on opam
<companion_cube>
;-)
<tane>
aah, thanks :)
Mercuria1Alchemi has joined #ocaml
<companion_cube>
it should contain everything you need, but if it doesn't please tell me
<tane>
alright, I'll have a look when my DNS is back up :)
uris77 has joined #ocaml
<tane>
ah yes, this has it all, is it mentioned somewhere in the documentation of containers? I saw something along the line of "See Gen" but no links to the actual module
<tane>
but I may have missed it
<companion_cube>
maybe it's missing, indeed — I'll add it to the readme
toomuchtvrotsurb has quit [Remote host closed the connection]
toomuchtvrotsurb has joined #ocaml
<companion_cube>
people say I reinvent the wheel, but astring is once again proof that Bünzli is the kind of wheels
<Drup>
(For me, he got the crown when he created the repository for Fut)
<companion_cube>
:D
<Drup>
(After that, nothing else matter anymore)
<dmbaturin>
Drup: Looks like edwin found the proof that it was rackspace problem. Not that it retroactively makes my wild ass guess more scientific, but still! ;)
ggole has quit []
mort___ has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
Kakadu has quit [Ping timeout: 240 seconds]
kakadu_ has joined #ocaml
infinity0 has quit [Remote host closed the connection]
<Algebr>
Drup: is fut supposed to compete with lwt and async? astring I can understand..
<Drup>
I don't know.
ygrek has quit [Ping timeout: 244 seconds]
infinity0 has joined #ocaml
^elyse^ has quit [Quit: Leaving]
<companion_cube>
I think he left that project on the side
shinnya has quit [Ping timeout: 240 seconds]
kakadu_ has quit [Remote host closed the connection]
Anarchos has joined #ocaml
lobo has quit [Quit: leaving]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
Anarchos has joined #ocaml
systmkor has quit [Quit: Leaving]
Anarchos has quit [Ping timeout: 256 seconds]
antkong_ has joined #ocaml
mac10688 has joined #ocaml
ygrek has joined #ocaml
<mort___>
evening all. got a question about using sexp and cstruct.syntax…
<Drup>
Hi mort___ :)
<mort___>
(hi drup :)
<mort___>
it's claimed that if i write something like `cenum e { X; Y } as uint8_t(sexp)` then i get sexp converters e_of_sexp etc
<mort___>
and when i ocamlobjinfo the generated .cmx file in my case, i see them (I think!):
<mort___>
28: function camlTftp_wire__sexp_of_errorcode_1037 arity 1 (closed)
<mort___>
(inline) -> (0: _);
<mort___>
29: function camlTftp_wire__errorcode_of_sexp_1039 arity 1 (closed) -> _;
<mort___>
yet!
<mort___>
when i try and build something that uses the Tftp_wire library, i get moaned at that
<mort___>
Error: Unbound value Tftp_wire.opcode_of_sexp
<mort___>
and similar
<mort___>
eg., Error: Unbound value Tftp_wire.errorcode_of_sexp