* pabs3
postpones this until he has time to learn ocaml
pabs3 has left #ocaml []
<flux>
sometimes I wish ocaml had 'pi' defined in Pervasives :), apprently that library (also) defines pi..
moglum has quit []
<flux>
must be one of the most-common defined symbol in ocaml programs (not that often, but which symbol is used for the same purpose more often?)
<flux>
hmph, what's wrong with defining type point = (float, float) instead of { x : float; y: float }..
<mrvn>
nothing
<flux>
infact I'd say there's something wrong in picking the latter, which that library does :)
<mrvn>
The later allows easier access to the members
<mrvn>
no matching required
<flux>
fst, snd?
<flux>
also not really, unless you also open the module where the record is defined
<mrvn>
do fst and snd get inlined by the compiler?
<flux>
(I most of the time avoid it, perhaps use module aliases)
<flux>
I don't know
<flux>
I think they might be
<mrvn>
if you open the module or in the module p.x is shorter than (fst p)
<flux>
gotta go for a while
moglum has joined #ocaml
<flux>
back!
<flux>
ocamlopt inlines fst
<flux>
in my code I rarely need to get fields from points, they are passed through the code when finally a few functions extract the fields
<flux>
much larger portion of the code involves creating such values
<flux>
which is where the syntactic overhead matters..
gim_ has joined #ocaml
screwt8 has joined #ocaml
moglum has quit []
moglum has joined #ocaml
_blackdog has joined #ocaml
vorago has joined #ocaml
moglum has quit [Read error: 110 (Connection timed out)]
<mrvn>
flux: A drawback of int*int is that it doesn't get recognised as type point easily. With records you always have the exact type.
<flux>
true, but I don't think it's a big drawback
<flux>
if you're doing graphs, chances are you've got lots of code involved manipulating such values
<flux>
of course, if you have, say, coordinates from two different coordinate systems, you could perhaps want to differentiate them
<mrvn>
Memory wise they should be identical, right? Block with 2 values?
<flux>
I believe so, yes
<ita>
bah, what about using ocamgraph for the stuff ?
<mrvn>
Wouldn't it be need if one could say 'type point = { x:int; y:int } | int * int'?
<flux>
I mean bar graphs, not directed graphs etc what ocamlgraph provides
<flux>
(I'm using ocamlplot)
<ita>
flux: who uses bar graphs nowadays ?
<flux>
mrvn, that would indeed be nice. I suppose it wouldn't hurt much.
<ita>
(worst kind of visualization ever)
<flux>
ita, well not bar graphs per se, but I'm drawing weather graphs
<flux>
anyway, ocamlgraph deals with completely different issues
<mrvn>
flux: if you have type Point1.t = { x:int; y:int } and type Point2.t = { u:int; v:int } can you pass a Point2.t to a function expecting a Point1.t?
<flux>
what's the correct terminology here?
<flux>
mrvn, no
<flux>
without using obj.magic atleast :)
<flux>
perhaps there should be a compiler-provided safe obj.magic, which would allow structural equivalence
<flux>
I'm not sure if that'd be difficult to implement, though
<mrvn>
Shouldn't be. The compiler knows the signature
<flux>
I'm thinking the type inference stage.. the type of that function isn't something that can be expressed with the current type system.
<mrvn>
right. That needs magic.
<ita>
and light
<ita>
lots of matches
<mrvn>
Sometimes I wish the compiler had some Obj.... function to give the type of a variable.
<mrvn>
like typeof(x) in C
<ita>
mrvn: something like inspect ?
<mrvn>
Unbound value inspect
<ita>
i think i have seen it in the ocaml book
<mrvn>
The manual has it neither as keyword nor as value.
<ita>
in any case you can use the interactive shell, or "ocamlc -i"
<ita>
the manual does not have it, but the book does
<flux>
mrvn, what would you use it for?
<mrvn>
flux: marshaling or debuging
<mrvn>
At runtime all you can get is the structure of a type but not the signature. So marshaling Point1.t and Point2.t from above gives the same data.
<flux>
there was a project that had extended the ocaml toplevel
<flux>
with type information queries
<flux>
and other things
<mrvn>
So for a network protocol you have to add type kind = POINT1 | POINT2 and add that before the data.
<flux>
I think I found it from caml weekly archives
<flux>
I like to put my network messages in a record
<flux>
make that: sum type
<flux>
or two sum types; one for requests, other for replies, in case of an asymmetric protocol
<ita>
mrvn: google translate
<mrvn>
ita: That seems to be just a description of the memory structure of types.
<ita>
mrvn: well, i mixed up with c programming as you do :-)
<mrvn>
ita: Same as the "Interfacing C with Objective Caml" in the manual.
<mrvn>
flux: You can use 'let convert_points p = Marshal.from_string (Marshal.to_string p []) 0;;
<mrvn>
' but you only get runtime check on the structure.
<flux>
hm, what's the point compared to Obj.magic?
<flux>
structural check?
<mrvn>
I hope so.
<flux>
but the compiler still handles those as string -> 'a and 'a -> string -functions
<flux>
so you could just as well type let (a:list) = Marshal.from_string (Marshal.to_String p 42.0)
<mrvn>
hmm, ot not.
<mrvn>
The Marshal module doesn't seem to even check the type.
<flux>
I don't think it can; type information is mostly removed during compilation
<flux>
gcaml did support type-safe marshalling
<flux>
but I guess that project is dead
<mrvn>
You can get the structure when you to to_string. But how do you get access to the structure you are supposed to create in from_string?
<mrvn>
About a year ago I wrote some marshaling code where you would pass along a representation of the argument. You could still screw up and give it the wrong representation but aside from that it was type safe.
descender has joined #ocaml
<mrvn>
Would be nice if one could write 'type var = Int of int | Float of float;; typeof(var);; --> VARIANT [ (0, [INTEGER]); (1, [FLOAT])]' or similar.
<flux>
well, that's basically what for example sexplib does
<flux>
but it needs you to add 'with sexp' after each involved type definition
<flux>
it declares sexp_of_var and var_of_sexp for you
<flux>
the latter has a more recent version, and isn't dead :)
<mrvn>
It should default to index.html instead of giving an error.
screwt8 has quit [Remote closed the connection]
<flux>
perhaps it's a misconfiguration, perhaps they want to have it that way :)
<flux>
have a look at the README, it has nice examples
<mrvn>
Then they should fix the url at the hump
<flux>
(well, actually, perhaps not, but something atleast)
<flux>
atleast it explains what is converts
<flux>
it even supports types like type 'a var = Int of 'a | Foo of (float * 'a var)
<flux>
(hm, why did I pick Int?-))
<mrvn>
it better be
screwt8 has joined #ocaml
<mrvn>
Looking at sexplib I have to remind myself again to learn ocamlp4.
malune_ has joined #ocaml
ed-t8 has quit [Read error: 104 (Connection reset by peer)]
postalchris has joined #ocaml
ygrek has joined #ocaml
moglum has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
malune_ has quit [Read error: 104 (Connection reset by peer)]
malune_ has joined #ocaml
screwt8 has quit [Read error: 104 (Connection reset by peer)]
screwt8 has joined #ocaml
love-pingoo has quit ["Leaving"]
pango_ has quit [Remote closed the connection]
slipstream-- has joined #ocaml
pango_ has joined #ocaml
mnemonic has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
<mnemonic>
hi
bluestorm_ has joined #ocaml
Demitar has quit [Read error: 104 (Connection reset by peer)]
Demitar has joined #ocaml
benny_ has joined #ocaml
benny has quit [Read error: 110 (Connection timed out)]
Smerdyakov has joined #ocaml
jlouis has joined #ocaml
rickardg has joined #ocaml
slipstream has joined #ocaml
mikeX has joined #ocaml
cjeris has joined #ocaml
slipstream-- has quit [Read error: 110 (Connection timed out)]
<tree_>
i am searching for some application that i could use to create diagram of my ocaml project, i want it to show the dependencies and associations between modules
<tree_>
it doesnt have to be automaticaly generated :)
<ita>
tree_: (so you do not have to use the dot by hand)
<ita>
pango_: are you part of the gnome clique ?
<pango_>
nope
<tree_>
ita, pango_ thx a lot ;)
<pango_>
np
<bluestorm_>
tree_:
<bluestorm_>
ocamldoc does that
<bluestorm_>
if i rember correctly
<bluestorm_>
ocamldoc -dot *.ml -o modules.dot
<bluestorm_>
dot -Tpng modules.dot -o graph.png
<tree_>
bluestorm_: that is kewl, thx
<bluestorm_>
wow
<flux>
it's a module dependency graph only, right?
<flux>
I'd like to see a static function-dependency graph..
<bluestorm_>
hm
<bluestorm_>
ocamldoc support type-dependencies too
<bluestorm_>
but function-dependecy seems to much
<bluestorm_>
i'm afraid you'd have to hack a bit
<flux>
there was some discussion that because of higher order functions, generating such graph would be very dificult, but I would be satisfied with one that didn't take those into consideration..
<mrvn>
They would appear in the function passing the function argument to the higher order function.
<mrvn>
Which is where the actual dependency occurs so that is ok.
<mrvn>
It just wouldn't match a call graph.
<bluestorm_>
hm
<bluestorm_>
otherwise it could be possible to generate a runtime call graph
<bluestorm_>
using some of the profiler internals
<flux>
you could simply use gprof
<flux>
but really, a static dependency graph would work for me :)
<flux>
(specifically, you could use tools that create pretty pictures out of gprof output; just recently one was on the freshmeat frontpage)
the_dormant has joined #ocaml
<mbishop>
ayrnieu: Have you used efuns?
Demitar has quit [Read error: 104 (Connection reset by peer)]
Demitar has joined #ocaml
gene9 has joined #ocaml
malune__ has joined #ocaml
the_dormant has quit ["Au revoir"]
the_dormant has joined #ocaml
Ai_Itai has joined #ocaml
gene9 has quit ["Leaving"]
malune_ has quit [Read error: 110 (Connection timed out)]
mnemonic has quit ["leaving"]
mnemonic has joined #ocaml
ygrek has quit []
Demitar has quit [Read error: 110 (Connection timed out)]
dark_light is now known as EliasAmaral
vital303 has joined #ocaml
ayrnieu has quit [Remote closed the connection]
skal has joined #ocaml
moglum has quit []
the_dormant has quit ["Au revoir"]
rickardg` has joined #ocaml
rickardg` has left #ocaml []
Submarine has joined #ocaml
rickardg has quit [Connection timed out]
rickardg has joined #ocaml
rickardg has quit [Client Quit]
<twobitsprite>
how do I find out what levels are defined in camlp4 for expr?
skal has quit [Remote closed the connection]
<postalchris>
twobitsprite: what do you mean by levels?
<twobitsprite>
like EXTEND expr: LEVEL "expr1" ....
<twobitsprite>
or [[ e1 = expr LEVEL "simple" ...
<twobitsprite>
I see these in the examples, and they're talked about in the docs, but I'm not sure what all the levels are and what they mean
<twobitsprite>
n/m
<twobitsprite>
I think I found it
bluestorm_ has quit ["Konversation terminated!"]
mnemonic has quit ["leaving"]
esdee has joined #ocaml
Mr_Awesome has joined #ocaml
cjeris has quit [Read error: 104 (Connection reset by peer)]
<esdee>
Any idea why this works fine, but fails with "Bad file descriptor" if I uncomment the call to daemon? http://pastebin.ca/492021