|Catch22| has quit [Read error: 113 (No route to host)]
mwc has joined #ocaml
mrsolo has joined #ocaml
mrsolo has quit ["This computer has gone to sleep"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
<ikatz>
is there a way to get more info on "Files x.cmo and y.cmo make inconsistent assumptions over interface Z"?
<ikatz>
like... what those conflicting assumptions might be?
<thermoplyae>
i've found that that means 'you compiled x or y against an old copy of z, recompile all three'
<ikatz>
oh ok
<thermoplyae>
no actual error, just stale information
<ikatz>
nice
<ikatz>
thanks
szell has joined #ocaml
AxleLonghorn has joined #ocaml
thermoplyae has quit ["daddy's in space"]
mrsolo_ has joined #ocaml
postalchris has joined #ocaml
postalchris has quit [Client Quit]
mrsolo_ has quit ["This computer has gone to sleep"]
jonathanv has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
mrsolo_ has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
ppsmimou has quit [Read error: 110 (Connection timed out)]
AxleLonghorn has quit ["Leaving."]
AxleLonghorn has joined #ocaml
jderque has joined #ocaml
evn has joined #ocaml
ygrek has joined #ocaml
mwc has quit ["Leaving"]
mrsolo_ has quit ["This computer has gone to sleep"]
Snrrrub__ is now known as Snrrrub
_W_ has quit ["off to Norway"]
jderque has quit ["leaving"]
shortcircuit has quit [Read error: 110 (Connection timed out)]
AxleLonghorn has left #ocaml []
ttamttam has joined #ocaml
filp has joined #ocaml
coucou747 has joined #ocaml
thermoplyae has joined #ocaml
thermoplyae has left #ocaml []
l_a_m has joined #ocaml
Snrrrub has quit [Read error: 110 (Connection timed out)]
gim_ has joined #ocaml
ppsmimou has joined #ocaml
munga has joined #ocaml
filp has quit ["Bye"]
musically_ut has joined #ocaml
gim_ is now known as gim
musically_ut has quit [Remote closed the connection]
OChameau has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
munga has quit [Read error: 104 (Connection reset by peer)]
goalieca has quit [Remote closed the connection]
Tetsuo has joined #ocaml
Tetsuo has quit [Remote closed the connection]
Tetsuo has joined #ocaml
eelte has joined #ocaml
coucou747 has quit [Read error: 110 (Connection timed out)]
bluestorm has joined #ocaml
evn has quit []
Linktim has joined #ocaml
Yoric[DT] has joined #ocaml
<Yoric[DT]>
hi
mrsolo has joined #ocaml
hkBst has joined #ocaml
mrsolo has left #ocaml []
linktim_ has joined #ocaml
LordMetroid has joined #ocaml
linktim__ has joined #ocaml
Melrose` has joined #ocaml
Melrose` has left #ocaml []
rwmjones has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
linktim_ has quit [Read error: 110 (Connection timed out)]
linktim__ has quit [Read error: 104 (Connection reset by peer)]
middayc has joined #ocaml
hkBst has quit [brown.freenode.net irc.freenode.net]
jlouis has quit [brown.freenode.net irc.freenode.net]
bla has quit [brown.freenode.net irc.freenode.net]
huh has quit [brown.freenode.net irc.freenode.net]
ertai has quit [brown.freenode.net irc.freenode.net]
hkBst has joined #ocaml
jlouis has joined #ocaml
bla has joined #ocaml
ertai has joined #ocaml
huh has joined #ocaml
* Yoric[DT]
is watching Beckman explain monads.
<Yoric[DT]>
To C# programmers.
<Yoric[DT]>
It's fun.
ygrek has quit [Remote closed the connection]
shortcircuit has joined #ocaml
Snrrrub has joined #ocaml
gawen has joined #ocaml
gawen has left #ocaml []
ygrek has joined #ocaml
lordmetroid_ has joined #ocaml
pango has quit [Remote closed the connection]
LordMetroid has quit [Connection timed out]
pango has joined #ocaml
lordmetroid_ has quit [Client Quit]
Tetsuo has quit [Remote closed the connection]
ygrek has quit [Remote closed the connection]
ttamttam has left #ocaml []
postalchris has joined #ocaml
delamarche has joined #ocaml
jonathanv is now known as jonafan
delamarche has quit [Client Quit]
delamarche has joined #ocaml
<Yoric[DT]>
Does anyone know if there's a simple manner of looking inside a .cmi and seeing what it defines ?
<bluestorm>
objinfo ?
<bluestorm>
hm, seems objinfo doesn't give the interfaces
<Yoric[DT]>
Exactly.
* Yoric[DT]
assumes there's a dirty hack involving generating a file with only an "include" statement and then calling ocamlc -i, but well, that's a hack :)
<bluestorm>
Yoric[DT]: note that "strings foo.cmi" is not *that* bad :-'
<Yoric[DT]>
Yeah, but I was hoping for something I could show my students :)
Tetsuo has joined #ocaml
marmottine has joined #ocaml
middayc has left #ocaml []
<flux>
yoric[dt], cmigrep
<flux>
atleast it accesses that information; grep for . to view all?
thermoplyae has joined #ocaml
mwc has joined #ocaml
<Yoric[DT]>
Thanks.
OChameau has quit ["Leaving"]
ita has joined #ocaml
monde has joined #ocaml
ita has quit ["Hasta luego!"]
<julm>
Yoric[DT]: % echo "val f : int -> unit" > toto.mli
<julm>
% ocamlc -c toto.mli
<julm>
% ls
<julm>
toto.cmi toto.mli
<julm>
% ocaml
<julm>
Objective Caml version 3.10.2+dev3 (2008-01-29)
<julm>
# module type M = Toto;;
<julm>
module type M = sig val f : int -> unit end
<Snrrrub>
Is there a way to create an in_channel from a string? I can't seem to find it in the docs
<pango>
nope... a stream from a string, but not a channel
<Snrrrub>
so usually if people are dealing with a binary network protocol (or binary file), is the standard approach to use a stream and write extraction routines?
thermoplyae has quit [Read error: 104 (Connection reset by peer)]
LordMetroid has joined #ocaml
ygrek has joined #ocaml
lament has joined #ocaml
<bluestorm>
Yoric[DT]: he must mean that declaring a module alias inside the toplevel get you a description of the module interface
<bluestorm>
+s
<julm>
Yoric[DT]: well it is not what you wanted? to read a .cmi?
thermoplyae has joined #ocaml
det_ has joined #ocaml
<bluestorm>
julm: that might fall in the "well, that's a hack :)" category, though
<flux>
wrap it to a script and it's perfect?-)
Robdor has joined #ocaml
middayc has joined #ocaml
<Yoric[DT]>
Well, that's a bit better than a hack.
<Yoric[DT]>
Thanks.
thermoplyae has quit ["daddy's in space"]
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
<Snrrrub>
Is there a way to get the integer representation of a (non-polymorphic) variant type?
<Snrrrub>
nvm, just found the "Obj" module.
<thelema>
Snrrrub: why do you want its int representation?
<thelema>
you're probably trying to work ocaml 'against the grain'
<Snrrrub>
Well, I'd like to use symbolic names instead of integers (I'll be serializing) and I need the values to auto-increment
<Yoric[DT]>
You could also take a look at deriving.
<thelema>
auto-increment?
<Snrrrub>
I need something equivalent to enum { V1, V2, V3, ... } in C
<Snrrrub>
yeah, I don't want to manually assign values because if I add something in the middle, I'll have to go and modify all of the subsequent values. I'm still in the nascent stages of my design so the order is likely to change heavily
<Yoric[DT]>
Unless you really really really know what you're doing, you're probably better off without Obj.magic.
<bluestorm>
wouldn't a simple translation function let to_int = function A -> 0 | B - > 1 ... do the job ?
<Snrrrub>
Yoric[DT], deriving? In what context are you using that term?
<Snrrrub>
Yoric[DT], thanks, I'll be looking at that! :-)
<Snrrrub>
bluestorm, if I insert something like A' between A and B then I'd have to change the value of B, C, D, ...
<bluestorm>
hm
<bluestorm>
there must be some trickery to avoid that
<Yoric[DT]>
(or something easier with type-conv)
<bluestorm>
hm yeah, i could provide you an automagically-generated foo_to_int with type-conv
<bluestorm>
Yoric[DT]: yesterday i basically implemented a "show_foo" type-conv extension
<Yoric[DT]>
Nice.
<bluestorm>
and then i realized deriving had it :-'
<flux>
it would be neat if such conversions were inlined efficiently by the compiler
<Yoric[DT]>
:)
<flux>
or atleast a lookup array was used
<flux>
is it?
<bluestorm>
it is
<bluestorm>
hmm
<flux>
phew, the inner optimizer in me is happy ;)
<bluestorm>
last time i checked, the generated -dlambda code use a switch-like code
<bluestorm>
and i *think* it's translated to a O(1) jump in the assembly
<bluestorm>
(but as i don't know assembly, what i deduce from ocamlopt -S may be pure bullshit)
<Yoric[DT]>
I never tried that.
<Yoric[DT]>
What exactly does -dlambda do ?
<bluestorm>
produce a representation of the intermediate (untyped, i think) program representation by the compiler
<bluestorm>
looks like scheme or lisp
* thelema
would like compiler support for using a variant type (all without arguments) as indexes into an array.
<bluestorm>
Snrrrub:
thermoplyae has joined #ocaml
<bluestorm>
how should an automatically-derived foo_to_int function react to constructors with parameters ?
<bluestorm>
fail miserably ?
<Snrrrub>
bluestorm, it should still be able to fetch the ordinal, no?
<bluestorm>
yes, the foo_to_int function could generate an ordinal
<bluestorm>
but you can't have an foo_of_int function, then
<thelema>
bluestorm: the ordinals wouldn't be one-to-one
<Snrrrub>
bluestorm, agreed
<Yoric[DT]>
thelema: isn't that what Hashtables are all about ?
<Snrrrub>
Strings in OCaml are mutable, yes?
<thermoplyae>
yes, they are
<Yoric[DT]>
To the regret of many :)
mwc has quit [Read error: 110 (Connection timed out)]
<hcarty>
Snrrrub: For a variant -> int, you could use some "%identity" trickery
<hcarty>
type t = A | B | C
<hcarty>
external t_to_int : t -> int = "%identity";;
<hcarty>
Perhaps not ideal for long term, but for testing or prototype purposes it may help
<hcarty>
And it may break if you added D of 'a or similar to type t ... I'm not sure
<Snrrrub>
I've never seen %identity before. I'm assuming it's a special function name that returns its input but gets around the type system because it's pretending to be native?
Poulet has joined #ocaml
<Yoric[DT]>
%identity is actually the same thing as Obj.magic .
<Yoric[DT]>
And yeah, it's native.
mwc has joined #ocaml
lament has left #ocaml []
<thelema>
Yoric[DT]: yes, hashtables can be used for that, but why sacrifice the performance of an array when you know ahead of time what buckets in the hashtable you'll want to use?
<Snrrrub>
bluestorm, oh man, thanks!! That is *extremely* useful!
<bluestorm>
hm
<bluestorm>
that's a bit messy right now
Anarchos has joined #ocaml
<Yoric[DT]>
Nice, still :)
<bluestorm>
i've just updated it : it generate a nice error message in case of a constructor with parameter
<bluestorm>
type test = | A | B | C | D | E of int
<bluestorm>
| 4 -> failwith "can't convert to a constructor with parameters: E"
<bluestorm>
an other idea would be to create a type-incorrect function, that would fail at compilation time
Poulet has left #ocaml []
* Yoric[DT]
thinks either would be fine.
olleolleolle has joined #ocaml
<olleolleolle>
hehe. back, huh.
Morphous has joined #ocaml
olleolleolle has left #ocaml []
l_a_m has quit [Remote closed the connection]
ygrek has quit [Remote closed the connection]
Morphous_ has quit [Connection timed out]
mwc has quit [Remote closed the connection]
thermoplyae has quit [Read error: 110 (Connection timed out)]
<thelema>
bluestorm: I guess that since the mistake is very local, it's not too bad to assume the user meant to use "with to_int" on a type having arguments
<bluestorm>
hm
<bluestorm>
i could even generate dummy values with Obj.magic () :-'
brooksbp has joined #ocaml
<thelema>
bluestorm: better not.
<bluestorm>
:p
<thelema>
I prefer programming without segfaults
<bluestorm>
who hasn't suscribed to the ocaml planet yet ? :)
<jonafan>
any graph wizards here? is there an awesome algorithm to convert an undirected graph to a directed graph and remove every unnecessary edge?
Poulet_ has joined #ocaml
lnostdal has quit [Read error: 104 (Connection reset by peer)]
brooksbp has quit []
<jonafan>
it'd be neat to take all the roads in a town and convert them all to one ways
<thelema>
jonafan: many of the edges would have to get duplicated to keep the same connectivity...
lnostdal has joined #ocaml
<jonafan>
yeah, they probably couldn't all be one ways
brooksbp has joined #ocaml
jlouis_ has joined #ocaml
<Snrrrub>
What are some techniques people use to overcome the unique record field name requirement? In my case, I have a record for each type of packet but some packets have the same field (e.g. resource_name). Do others face this problem? Am I not doing things the OCaml way?
<jonafan>
i tend to put things in different modules
<pango>
put them in modules, use different prefixes for fields names, use objects,...
<Anarchos>
Snrrrub i prefix with a name reflecting the usability of this particular record type
<Snrrrub>
Hmm, I see. Thanks...
<bluestorm>
the different modules solution is quite nice imho
<bluestorm>
as you have flexible prefixing
<Anarchos>
bluestorm yes it is the more ocaml flavored
<bluestorm>
(eg. if you work in a specialized context, you can open the corresponding module and don't bother with the prefix)
delamarche has quit [Read error: 104 (Connection reset by peer)]
<Snrrrub>
But I wouldn't be able to create an instance of the record directly, yes? I'd have to include a create_whatever function in the module?
delamarche has joined #ocaml
<bluestorm>
hm
<bluestorm>
you can use
<bluestorm>
{ Mod.foo = val }
<bluestorm>
and access then with bar.Mod.foo
<Snrrrub>
Ah, that's where the module naem goes.
jlouis has quit [Read error: 110 (Connection timed out)]
marmottine has quit [Remote closed the connection]
jlouis_ has quit ["leaving"]
middayc has left #ocaml []
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
Yoric[DT] has quit ["Ex-Chat"]
qwr has quit [Remote closed the connection]
qwr has joined #ocaml
eelte has quit ["bye ca veut dire tchao en anglais"]