<adrien_oww>
hmm, and link? and you can check with the Printexc module too
Thooms has joined #ocaml
Thooms has quit [Remote host closed the connection]
<mrvn>
ahh, now it works. seems I forgot a make clean
contempt has quit [Ping timeout: 252 seconds]
<mrvn>
thx
contempt has joined #ocaml
<adrien_oww>
:)
watermind has joined #ocaml
Thooms has joined #ocaml
contempt has quit [Ping timeout: 265 seconds]
contempt has joined #ocaml
thomasga has quit [Quit: Leaving.]
rand000 has quit [Ping timeout: 260 seconds]
mcclurmc has joined #ocaml
mcclurmc has quit [Ping timeout: 265 seconds]
avsm has quit [Quit: Leaving.]
divyansr has quit [Remote host closed the connection]
boogie has joined #ocaml
divyansr has joined #ocaml
watermind has quit [Read error: Connection reset by peer]
watermind has joined #ocaml
boogie has quit [Ping timeout: 245 seconds]
munga has joined #ocaml
<munga>
why I can write let f = let module M = Set.Make(String) in M.union ;; but not let f = let module C ( X : Set.S ) = struct let cup = let open X in union end in C(Set.Make(String)).cup;; ??
<munga>
let module does not work with functors ?
<asmanur>
munga: you can use let module C = functor (X : Set.S) -> struct ... end in ...
<asmanur>
(well the parser accepts it)
<companion_cube>
I think the problem is that the type returned in the first case is "known" (Set.S with type elt=string)
<companion_cube>
but in the second one, there is no way the world outside f knows about C(Set.Make(String))
<asmanur>
hm
<munga>
I get Error: Unbound constructor C ...
watermind has quit [Quit: Konversation terminated!]
<asmanur>
munga: yeah putting let module D = C(Set.Make(String)) in D.cup works here
watermind has joined #ocaml
<munga>
ok... so the problem is not about types, but more about syntax ?
<asmanur>
it seems so
watermind has quit [Read error: Connection reset by peer]
divyansr has quit [Remote host closed the connection]
watermind has joined #ocaml
<munga>
maybe using the new syntax of the first class modules ...
<munga>
thanks anyway this solves my immediate problem ...
divyansr has joined #ocaml
Simn is now known as Simn|gone
watermind has quit [Client Quit]
watermind has joined #ocaml
<gasche>
munga: I'd try let module M = C(Set.Make(String)) in M.cup
rand000 has joined #ocaml
<gasche>
F(X).foo is not allowed in *expressions* because it could also mean, say, Some(None).absurd_field
<munga>
gasche, yep, that works ... aaaaaaaa good point !
<munga>
thanks !
<munga>
even though I would expect the compiler to know when Some(None) is a variant constructor and when it's a functor ...
<gasche>
we don't do that kind of "backtracking semantics"
<gasche>
that said
<gasche>
in this precise case, the variant-constructor-interpretation is always going to fail, as values of sum types do not have fields
<gasche>
so we could say that, in the face of a parsing ambituity, the parser should rather take the choice that may have a meaning
<gasche>
(but the idea is not to say "pick whichever works first")
avsm has joined #ocaml
thomasga has joined #ocaml
<pippijn>
gasche: Some(None).field can happen?
<pippijn>
or Foo(Bar).field?
<gasche>
it is syntactically valid
<gasche>
but never semantically so
<pippijn>
ah ok
<pippijn>
yes, makes sense
<flux>
ocaml likes non-ambigious parse trees also :)
<gasche>
I justed looked at the manual again, it explicitly specifies that in <module-path>.name, or <module-path>.Constructor, the module path may not contain functor application
<def-lkb>
but Some (A.Module.Path.record).record_field can be valid as an expression…
<gasche>
so the grammar is not ambiguous, and the "alternate choice" I suggested is not an option according to the specification
<gasche>
haha, good catch def-lkb
rand000 has quit [Ping timeout: 260 seconds]
<gasche>
what is confusing is that <extended-module-path>.type (or module-type, class-type etc.) is valid, and must occur in practice in inferred types
<gasche>
(or specified types)
<flux>
I think ocaml should work like that when I type in an expression, I can whisper what I mean by it
<gasche>
so the type expression language is more permissive than the expression language regarding qualified paths
<flux>
and then the compiler would do it the right way
<flux>
(sorry ;-))
johnelse has quit [Quit: leaving]
divyansr has quit [Remote host closed the connection]
johnelse has joined #ocaml
rand000 has joined #ocaml
<gasche>
one language design idea I've been toying with is to extend a GLR-style parser (which returns "forest" in case of parsing ambiguities) with an ambiguity-aware lookup phase and type-checker (that work on alternating trees), and defer the resolution of ambiguities as long as possible
<gasche>
(if you're crazy you can even allow having several well-typed interpretations of an expression, as long as there are unit tests that will filter out the bad one)
<gasche>
(or more reasonably some form of static assertion verifier)
<gasche>
that is consistent with how mathematicians handle ambiguities in their meta-language
<gasche>
"oh this clearly doesn't mean Foo, the question would be trivial"
<pippijn>
gasche: that's how elsa's c++ parser works
<mrvn>
Don't you love to get THIS_COULD_BE_FOO_BAR_OR_BAZ tokens?
<flux>
gasche, so if you decide to do it, you won't be in good company ;-)
<pippijn>
mrvn: in C++, until recently, that was only a NAME_OR_TYPE token
<pippijn>
mrvn: but now it's NAME_OR_OVERRIDE, NAME_OR_FINAL tokens :\
<pippijn>
actually
<pippijn>
NAME_OR_TYPE_OR_OVERRIDE
<pippijn>
(and final)
<mrvn>
a foursome?
<def-lkb>
gasche: tooling would be awesome to work on with that kind of languages
<flux>
just add _OR_WHATEVER, be done with it and go to have a beer
watermind has quit [Read error: Connection reset by peer]
<mrvn>
T_ANYTHING
watermind has joined #ocaml
<flux>
a language that is a superset of both c++ and php
<flux>
and haskell
watermind has quit [Client Quit]
<flux>
that would be the most compelling software project in the universe
watermind has joined #ocaml
<pippijn>
flux: wmeyer would have liked that
<pippijn>
and he'd be doing it with PEG
thomasga has quit [Quit: Leaving.]
<def-lkb>
except to workaround mistakes in the design of existing languages, are there real benefits in supporting non-LR(1) (or even k) grammars?
rand000 has quit [Ping timeout: 252 seconds]
mcclurmc has joined #ocaml
thomasga has joined #ocaml
rand000 has joined #ocaml
<pippijn>
def-lkb: mostly if you want to extend the language
<pippijn>
def-lkb: in which case you need context-sensitive grammar
<def-lkb>
pippijn: good points, there is no reason in a core language to be non-LR(k), but it makes sense to support various extensions
<mrvn>
damn, I'm trying to figure out why my programm blows up and now I see that the zmq bindings of one function don't work.
<mrvn>
it returns a sensible result, just not a correct one
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
divyansr has joined #ocaml
<mrvn>
How do I make an ocaml string out of a byte array that contains zeroes?
<mrvn>
I think CAMLparam can't work as class. CAMLlocal would though.
<mrvn>
Make a class that is a value, register it in the constructor and deregister it in the destructor.
<pippijn>
CAMLparam can't work only as a class
<pippijn>
it can work like in the macro I wrote above
<pippijn>
CAMLlocal can't be a class, because it needs to reference the stack stuff
<pippijn>
caml_local_roots
<mrvn>
anyway, I have C code.
<pippijn>
yes :)
<def-lkb>
:)
<pippijn>
and ocaml runtime is in C
kyrylo has joined #ocaml
rwmjones has joined #ocaml
<adrien_oww>
and asm
<gasche>
companion_cube: meh
<companion_cube>
:D
avsm has quit [Quit: Leaving.]
contempt has quit [Remote host closed the connection]
darkf has quit [Quit: Leaving]
thomasga has quit [Quit: Leaving.]
contempt has joined #ocaml
rand000 has quit [Ping timeout: 272 seconds]
divyansr has quit [Remote host closed the connection]
contempt has quit [Ping timeout: 252 seconds]
divyansr has joined #ocaml
contempt has joined #ocaml
kyrylo has quit [Quit: Hi, Rob!]
kyrylo has joined #ocaml
divyansr has quit [Remote host closed the connection]
shinnya has joined #ocaml
<companion_cube>
gasche: what about all the code you know that uses the %identity primitive?
<companion_cube>
e.g. to efficiently build lists?
rand000 has joined #ocaml
contempt has quit [Ping timeout: 245 seconds]
Simn|gone has quit [Ping timeout: 252 seconds]
Eyyub has joined #ocaml
contempt has joined #ocaml
f[x] has quit [Ping timeout: 252 seconds]
<gasche>
companion_cube: that's a different use than injecting phony default values to avoid an ('a option)
<companion_cube>
yes, but it's inherently unsafe too
<gasche>
yes?
<def-lkb>
in one case you are breaking value representation, (so that you assume the user will never observe the wrong value), in the other you just give hints to the type checker :)
<def-lkb>
(right?!)
contempt has quit [Ping timeout: 272 seconds]
contempt has joined #ocaml
<companion_cube>
in the example I think of, you convert type 'a t= { head:'a; mutable 'a t next; } into a list
csakatoku has joined #ocaml
munga has left #ocaml []
csakatoku has quit [Remote host closed the connection]
<nicoo>
gasche: Sorry to pester you, but it seems you didn't get my previous messages (or I missed your answer) : in bug #4747 (Hashtbl.resize is not tail recursive), why didn't you consider making bucketlists mutable? Because of the write barrier?
<companion_cube>
well you could use the exact same trick?
contempt has quit [Ping timeout: 245 seconds]
contempt has joined #ocaml
<nicoo>
companion_cube: I don't see how building it mutable then converting to immutable representation would avoid the write barrier
<companion_cube>
well you would play by the rules (write barrier and all)
<companion_cube>
but in a tailrec fashion
<companion_cube>
ie, build a list from head to tail
<companion_cube>
you build a mutable_bucket_list array, convert to a bucket_list array et voilà !
<nicoo>
companion_cube: Yes. But since the bucketlists aren't exposed to the outside, you can make them mutable and not use Obj.magic
<companion_cube>
ah, right
<gasche>
nicoo: indeed, I didn't see your previous messages on that
<nicoo>
Ok
<gasche>
using a mutable bucket list would add more indirections to the memory representation
<gasche>
(because the constructors of a sum type cannot be mutable)
<def-lkb>
nahhh, that case is easy, just initialize with Obj.magic ()
<gasche>
it would also make Hashtbl.copy more costly but I guess that's a good trade-off for a slightly faster remove()
contempt has quit [Ping timeout: 252 seconds]
dsheets has quit [Ping timeout: 252 seconds]
contempt has joined #ocaml
<nicoo>
Ah, I see. So the evil Obj.magic trick would actually help there ?
<def-lkb>
Not reallocating the prefix of the list leading to the removed element
<nicoo>
def-lkb: Yes, I understood why remove is made faster
<gasche>
there is a nice implementation using standard functional programming techniques
<gasche>
I'm not sure if using Obj.magic after moving to an explicit mutable-linked-list model can be considered "helping"
<gasche>
(I'd rather write Mezzo code directly and compile it down to OCaml if that's what we want to do)
csakatoku has joined #ocaml
divyansr has joined #ocaml
<nicoo>
gasche: No, for a moment I thought that the Obj.magic trick might be used to avoid the extra indirection. But that's not actually the case, right ? :(
<gasche>
you can do that, but the extra indirection is only present in your mutable version, not in the immutable one
talzeus has joined #ocaml
talzeus has quit [Remote host closed the connection]
talzeus has joined #ocaml
<gasche>
essentially what you would use is the same trick we use in Batteries, except with two-elements instead of one-element lists
divyansr has quit [Remote host closed the connection]
contempt has quit [Ping timeout: 245 seconds]
<gasche>
this is doable, but hard to justify over simply reversing the lists from time to time
WraithM has joined #ocaml
<companion_cube>
can you reverse bucket lists in hashtables? that doesn't sound right
<companion_cube>
w.r.t multiple bindings for the same key
<gasche>
read the patch, I'm going back to work :p
<gasche>
( I'm not terribly happy with this patch, which is probably the reason why it hasn't been included )
<companion_cube>
btw I don't see anything that should go into incubator ;)
<nicoo>
gasche: Sure. (And yes, I saw the version using rev)
<companion_cube>
ah, that's tail-call rev_map, then rev?
<nicoo>
Thanks for the explanation
<companion_cube>
(basically?)
<nicoo>
companion_cube: Basically, yes
<gasche>
companion_cube: then you can go ahead and release
saml has joined #ocaml
<gasche>
I have enough on my plate
<companion_cube>
I understand
introom has quit [Quit: WeeChat 0.4.2]
<companion_cube>
I'll do it tonight
introom has joined #ocaml
mcclurmc has quit [Read error: Connection reset by peer]
cago has left #ocaml []
contempt has quit [Ping timeout: 246 seconds]
introom has quit [Client Quit]
mcclurmc has joined #ocaml
contempt has joined #ocaml
thomasga has joined #ocaml
dsheets has joined #ocaml
f[x] has joined #ocaml
ulfdoz has joined #ocaml
tobiasBora has joined #ocaml
avsm has joined #ocaml
boogie has joined #ocaml
boogie has quit [Ping timeout: 265 seconds]
andymw has joined #ocaml
andymw has left #ocaml []
mika1 has quit [Quit: Leaving.]
talzeus has quit [Read error: Connection reset by peer]
avsm has quit [Quit: Leaving.]
shinnya has quit [Ping timeout: 265 seconds]
Kakadu has quit [Quit: Page closed]
lostcuaz has joined #ocaml
martintrojer has quit [Ping timeout: 248 seconds]
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
ollehar1 has quit [Ping timeout: 276 seconds]
ollehar has joined #ocaml
FreeArtMan has quit [Ping timeout: 245 seconds]
ulfdoz has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
nikki93 has quit [Remote host closed the connection]
nikki93 has joined #ocaml
jbrown has joined #ocaml
pminten has joined #ocaml
olliefr has joined #ocaml
smondet_ is now known as smondet
tobiasBora has quit [Ping timeout: 252 seconds]
Kakadu has joined #ocaml
avsm has joined #ocaml
ollehar has quit [Ping timeout: 276 seconds]
ollehar has joined #ocaml
ulfdoz has quit [Ping timeout: 245 seconds]
Simn has joined #ocaml
divyansr has joined #ocaml
ulfdoz has joined #ocaml
Thooms has quit [Ping timeout: 272 seconds]
divyansr has quit [Remote host closed the connection]
divyansr has joined #ocaml
divyansr has quit [Remote host closed the connection]
divyansr has joined #ocaml
jbrown has quit [Ping timeout: 265 seconds]
jwatzman|work has joined #ocaml
boogie has joined #ocaml
FreeArtMan has joined #ocaml
thomasga has quit [Read error: Operation timed out]
ontologiae has quit [Ping timeout: 252 seconds]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
mfp has quit [Ping timeout: 252 seconds]
gustav_ has quit [Ping timeout: 272 seconds]
avsm has quit [Ping timeout: 260 seconds]
gustav has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
Thooms has joined #ocaml
S11001001 has joined #ocaml
S11001001 has quit [Changing host]
S11001001 has joined #ocaml
FreeArtMan has quit [Quit: main.lv]
FreeArtMan has joined #ocaml
mfp has joined #ocaml
ollehar has quit [Ping timeout: 276 seconds]
ollehar has joined #ocaml
lopho has joined #ocaml
jonludlam has quit [Remote host closed the connection]
<erider>
does anyone have any suggestions on how to read ocaml source code ie from the right of the = and start at the right most function and work your way to the left
<mrvn>
I would go left to right
<erider>
mrvn: on the right hand side of the =
<S11001001>
erider: focusing on the order of execution will obscure the meaning of the program, not aid in understanding it.
<mrvn>
if it makes a diffewrence then the code is bad
<erider>
S11001001: what do you suggest then
pminten has quit [Quit: Leaving]
skchrko has quit [Quit: Leaving]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
mcclurmc has joined #ocaml
<S11001001>
erider: There's no step-by-step process. Perhaps, note the functions you recognize, which, if you've thought about them enough, should let theorems, free & otherwise, about them float to the top of your mind. Then drill down into any particular level you don't recognize.
mcclurmc has quit [Remote host closed the connection]
divyansr has quit [Quit: Leaving...]
jbrown has joined #ocaml
mhi^ has joined #ocaml
f[x] has quit [Ping timeout: 265 seconds]
dant3_ has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
dant3 has quit [Ping timeout: 246 seconds]
tianon has joined #ocaml
AltGr has left #ocaml []
ollehar has quit [Ping timeout: 276 seconds]
ollehar has joined #ocaml
manizzle has joined #ocaml
<mrvn>
I'm trying to make STREAM sockets send a zero message on connect. I'm calling stream_engine_t::push_msg_to_session() in zmq::stream_engine_t::plug() for raw sockets. That puts the message in the queue but does not flag the socket for having pending messages. So a recv_msg() blocks till the peer sends some data. Only then the zero message is recieved. Ideas?
FreeArtMan has quit [Ping timeout: 248 seconds]
skchrko has joined #ocaml
ollehar has quit [Ping timeout: 276 seconds]
ollehar has joined #ocaml
mort___ has joined #ocaml
ollehar has quit [Ping timeout: 276 seconds]
ollehar has joined #ocaml
Anarchos has joined #ocaml
kyrylo has quit [Quit: Hi, Rob!]
jbrown has quit [Remote host closed the connection]
ollehar has quit [Ping timeout: 276 seconds]
ollehar has joined #ocaml
struktured has joined #ocaml
<struktured>
hi all, is there some way using metocaml / ocamlp4 / etc., to implement generic funtions (eg. to_json_string :'a -> string) ? After two nights of my own research, I can't figure it out. I did find a method which implements generics, but it requires a 2nd argument to encode the type information, which is undesirable
mcclurmc has joined #ocaml
<companion_cube>
struktured: many people use deriving or type_conv (with camlp4) to generate this kind of functions
<Drup>
struktured: if you can use camlp4, the library deriving can do that
<Drup>
in the specific case of json, it's implemented in yojson or js_of_ocaml
<struktured>
js_of_ocaml? awesome. I didn't find anything like that in my search. I simply saw the pattern of string_of_some_type for some_type I added deriving to
<Drup>
yeah, there is a package deriving.js_of_ocaml with "deriving (Json)" in it.
ollehar has quit [Ping timeout: 276 seconds]
<struktured>
interesting- I will investigate further on my own. Sounds like exactly what I need
<Drup>
actually, it's js_of_ocaml.deriving
ollehar has joined #ocaml
<Anarchos>
struktured Obj.magic
ollehar has quit [Ping timeout: 276 seconds]
<struktured>
Drup: from what I can see, there is one module which requires 'a t (it's json representation) as well as 'a, which is a bit annoying:http://ocsigen.org/js_of_ocaml/api/Deriving_Json . Then there's another which is unsafe but simpler: http://ocsigen.org/js_of_ocaml/api/Json as it doesn't require explicit type information. is there a best of both worlds?
ollehar has joined #ocaml
<Drup>
no, you should read the description of deriving
<companion_cube>
hcarty: are you here? :)
<Drup>
basically, you have a type my_type you want to transform to json, you declare the type my_type and add "deriving (Json) at the end. After that, you can do "Deriving_Json.to_string Json.t<my_type> blabla"
<Drup>
(with blabla of type my_type)
<Drup>
and the syntax extension will generate the necessary code to transform blabla in to json
<Drup>
it's not fully polymorphic, but that's enough most of the time
<struktured>
yeah but my point is its two argument function, requiring type information as one of the arguments. correct?
<Drup>
yes, but the type information is automatically generated by the syntax extension, you don't have to actually write it
<struktured>
I don't have to write the types, or I don't have to include them when invoking Deriving_Json.to_string ?
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Drup>
not sure to see what you mean by this question x)
<struktured>
Drup, basically, from a refactoring standpoint. I am exposing the type signature every time I invoke to_string
<struktured>
which I'm not a fan of. rather have the type system infer it, like it usually would
<S11001001>
erider: there's a particular Dijkstra paper that explains the point I was trying to make; looking for it
Eyyub has quit [Ping timeout: 246 seconds]
<erider>
that would be interesting thanks
<Drup>
struktured: as I said, it's not fully polymorphic, it's a sort of nicer version of your option "I did find a method which implements generics, but it requires a 2nd argument to encode the type information"
<Drup>
struktured: it's just that the generics part is not done by hand, just done by the syntax extension
<Drup>
I'm not sure if I can be more precise than that, you should just try to use it, it will be pretty clear how it works
<struktured>
Drup, no I get it. I just was hoping for some sort of syntax extension which also infers those types too
<struktured>
Drup, thanks for the clarity
<Drup>
no, No magic :p
<struktured>
Drup: for background, I have much painful experience with java generics. I change the name of a type and I need to replace it in a zillion places because the generic type system isn't smart enough to infer it in places which it should.
<Drup>
that would be true, but I doubt you will use the json function that much
ollehar has quit [Ping timeout: 276 seconds]
<struktured>
drup: how do you inspect your values in practice, then? I was going to use a logging framework with json as my first class citizen to go from ocaml to string
ollehar has joined #ocaml
<Drup>
you mean, printing for debug and "emergency" inspections ? in the original deriving library, you can derive Show (and some other stuff) for that
<struktured>
Drup, ok thank
_andre has quit [Quit: leaving]
<struktured>
Anarchos: I as told obj.magic is evil so I ignored it as a possibility
<Anarchos>
struktured yes it is evil :)
tobiasBora has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
Eyyub has joined #ocaml
Thooms has quit [Quit: WeeChat 0.3.8]
olliefr has quit [Read error: Connection reset by peer]
struktured has quit [Ping timeout: 252 seconds]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
mcclurmc has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
struktured has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
olliefr has joined #ocaml
olliefr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mcclurmc has quit [Remote host closed the connection]
shinnya has joined #ocaml
Lajjla is now known as AirWolfTheme
Eyyub has quit [Ping timeout: 260 seconds]
mcclurmc has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
axiles has quit [Remote host closed the connection]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
rand000 has quit [Quit: leaving]
thomasga has joined #ocaml
nisstyre has joined #ocaml
olliefr has joined #ocaml
ollehar has quit [Ping timeout: 276 seconds]
ollehar1 has joined #ocaml
Kakadu has quit []
thomasga has quit [Quit: Leaving.]
NoNNaN has joined #ocaml
istima has joined #ocaml
<istima>
hi everyone
<companion_cube>
hi
<nlucaroni>
o/
<istima>
:) i'm kind of new on IRC, but i came here to find people that are interested in developing app
<istima>
hope i'm in the right place
<Drup>
as long as it's in ocaml :)
<istima>
nice :), any french people around here or people watching what's happening in France right know (regarding media censorship mainly) ?
ollehar1 has quit [Ping timeout: 276 seconds]
oriba has joined #ocaml
<istima>
i'm fed up with internet actual censorship, mainly on youtube and daylimotion, so i came out with an idea to avoid this. I don't know if it can be a good idea, i'd like to discuss about it and perhaps find some people interested in developing this
<istima>
i'm a c++ dev as well, but to develop such an app i can't do it on my own, or it will take too much time
Anarchos has quit [Quit: Vision[0.9.7-H-20131020]: i've been blurred!]
<oriba>
istima, write a RFC for it first! ;-)
<istima>
RFC ?
<oriba>
Request For Comment
<oriba>
(but it was a joke)
<istima>
sorry too new on IRC to catch this :)
<oriba>
(but every joke has a serious core)
<oriba>
ok
<oriba>
what kind of tool should it be? And why do you talk about it here? Do you want to write it in OCaml?