<gkelly>
type a = One | Two;; type b = One | Three;; let c : a = One;;
<gkelly>
How come I can't do that?
<flux>
ocaml doesn't have ovearloading. One cannot refer to both a's constructor and b's constructor.
<flux>
overloading even
<flux>
workarounds: module A = struct type t = One | Two end module B = struct type t = One | Three end let c = A.One;;
<flux>
actually a fellow has written a patch that allows the kind of behaviro you're suggesting but I don't think it's going to the main stream ocaml any soon..
<flux>
another workaround is to use polymorphic variants: type a = [ `One | `Two ] type b = [ `One | `Three ] let c = `One
<flux>
(but it has its drawbacks error-message-wise, I suggest reading the manual about those)
<gkelly>
flux: Ah, I see! Thank you very much for clearing that up for me.
Snark has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Ping timeout: 240 seconds]
Yoric has joined #ocaml
f[x] has joined #ocaml
ygrek has joined #ocaml
avsm1 has quit [Quit: Leaving.]
ikaros has joined #ocaml
ttamttam has joined #ocaml
maattd|away is now known as maattd
Submarine has joined #ocaml
Yoric has quit [Quit: Yoric]
enthymene has quit [Quit: rcirc on GNU Emacs 23.1.1]
maattd has quit [Remote host closed the connection]
ikaros has quit [Quit: Leave the magic to Houdini]
ikaros has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
npouillard has joined #ocaml
* Camarade_Tux
starts writing an ocaml tar implementation
<Camarade_Tux>
I'm sure it won't take long :P
<mrvn>
From scratch or using libtar?
<Camarade_Tux>
from scratch: I wanted to use tar on windows yesterday and couldn't find a working binary
<mrvn>
gkelly: type a = One | Two;; let make_a_one () = One let make_a_two () = Two type b = One | Three let c = make_a_one ()
pimmhogeling has joined #ocaml
<flux>
well, yes, but dealing with such values is a painful :)
<mrvn>
gkelly: module A = struct type t = One | Two end module B = struct type t = One | Three end let c = A.One;;
<Camarade_Tux>
msys tar works only in msys, mingw.org bsdtar creates corrupt archives, my own-compiled bsdtar has the same problem, gnu tar is a bitch to compile on windows...
<mrvn>
gkelly: pick your poison
<mrvn>
third option: type a = A_One | A_Two ...
<Camarade_Tux>
I find that for simple cases, polymorphic values don't make error message worse and may actually improve them
<flux>
mostly polymorphic variants don't cause difficult-to-understand errors if you annotate the types of your functions using them
<Camarade_Tux>
lablgtk has been a bit annoying in this regard and I'm often lost in its API (but I imagine it could be worse)
<Camarade_Tux>
(but I don't care, I'm writing an FRP layer to gtk next \o/ )
<mrvn>
to make a bad thing worse?
<Camarade_Tux>
yup :-)
<Camarade_Tux>
I'm really after a functional interface to a graphical toolkit (actually to gtk or qt) and since there is none... well, I can at least try and see how it goes
<Camarade_Tux>
I think it should be quite easy and quite fast to get a "first" version with very basic support, from then I can see if it could be worth it
avsm has joined #ocaml
<flux>
any amazing examples of neat user side code for the lib-to-be?-)
<Camarade_Tux>
not really, I haven't started it at all, I'll do it after I've completed my "ocaml-tar" (I don't need a full implementation of tar actually)
<Camarade_Tux>
I could get something interesting by the end of the week, we'll see
<flux>
but wasn't there some FRP-gtk-thingy around already or am I thinking something else?
<Camarade_Tux>
the todo list starts with "ask on the mailing-list about already existing work" ;-)
<mrvn>
I would like to see a GUI framework completly in ocaml. Not something put on top of something already messed up.
<Camarade_Tux>
but it's a big daunting task =/
<mrvn>
Start with completing Graphics.X11
<Camarade_Tux>
enlightenment foundation libraries (for e17, maybe e16) looked quite nice, and I've seen them on win32, with a bunch of different rendering engines (gdi, some other win* api, opengl...) and perf was good and looked good too
<mrvn>
Never used them
<Camarade_Tux>
I haven't either, two concerns however: they're young and not complete yet (although almost) and it looks like they're suffering from some NIH syndrome (or maybe they want to provide the most consistent interfaces possible)
Submarine has quit [Read error: Operation timed out]
Alpounet has joined #ocaml
gim has quit [Remote host closed the connection]
<Camarade_Tux>
actually, I may not write an ocaml tar implementation: I just fixed bsdtar: it wasn't opening files as binary so it defaulted to text with the corresponding end-of-line conversions on windows
* Camarade_Tux
awards the most stupid bug of the year 2009 to bsdtar
* olegfink
once had to implement tar -x in bash
<Camarade_Tux>
at least it should be quite portable across different architectures :P
maskd has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
mal`` has quit [Quit: Coyote finally caught me]
mal`` has joined #ocaml
ztfw has joined #ocaml
_andre has joined #ocaml
<mrvn>
"Remember about Noahs Ark? The unicorns missed the boat."
maskd has quit [Ping timeout: 252 seconds]
_zack has joined #ocaml
ygrek has joined #ocaml
smimou has quit [Ping timeout: 265 seconds]
smimou has joined #ocaml
_zack has quit [Quit: Leaving.]
_zack has joined #ocaml
maskd has joined #ocaml
<mrvn>
Once again i find myself wishing for "cyclic" dependencies between modules and interfaces. A.ml depends on B.mli and B.ml on A.mli. Now I have to use a HUGE let rec f1 = ... and f2 = ... and f3 = ... and f4 = ... and f5 = ... ...
<mrvn>
or let b_fn = ref (fun _ -> assert false) and let _ = A.b_fn <- fn
derdon has joined #ocaml
<_andre>
you could pass b_fn as an argument to A's functions
<flux>
use objects and object types :)
<mrvn>
_andre: That would make the interface of A ugly. But it is a possibility.
<mrvn>
flux: how do objcts help?
<flux>
you put the class types into one module, and everything depensd on that module
<mrvn>
flux: I think they would still require me to pass the B object to A.
fraggle_ has quit [Ping timeout: 276 seconds]
<mrvn>
If it were only a dependency of the types then i could move just them into a common file.
<flux>
ifaces.ml: class type a = object method get_b end and b = object method get_a end a.ml: class t : Ifaces.a = object method get_b : Iface.b end b.ml: class t : Ifaces.b = object method get_a : Iface.a end
<flux>
and within a class you can refer to any method via self
<mrvn>
flux: But not to A.obj and B.obj
<flux>
hm, true, in the cases I've passed those I already have an object passed to me
<mrvn>
That would be the same a passing B.fn to functions in A
<flux>
so somewhere there is code: let a = new A.t b etc
<flux>
yes, but you can do it in bundles :). like with records.
<mrvn>
type iface = { fn1 : unit -> unit; fn2 : bool -> string; }
<mrvn>
But I think I can narrow it down to exactly one function. If I break the cycle there then everything else can be sorted.
companion_cube has quit [Ping timeout: 256 seconds]
<mrvn>
Another question. I need an enumerable universal container that has no runtime or memory overhead. I now have something like type key = A of int | B of int type entry = key * Obj.t let make_a i (a : A.t) = (A i, Obj.repr a) let get_a i = ((Obj.obj (find (A i)) : A.t)
<mrvn>
Ideas how to make that saver without runtime cost?
companion_cube has joined #ocaml
dark has quit [Ping timeout: 260 seconds]
Snark has quit [Quit: Ex-Chat]
boscop has joined #ocaml
threeve has joined #ocaml
EliasAmaral has joined #ocaml
ztfw has quit [Remote host closed the connection]
Drk-Sd has joined #ocaml
jonafan_ is now known as jonafan
gildor has quit [Ping timeout: 276 seconds]
companion_cube has quit [Ping timeout: 265 seconds]
diml has quit [Ping timeout: 265 seconds]
gildor has joined #ocaml
companion_cube has joined #ocaml
diml has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
ulfdoz has quit [Ping timeout: 260 seconds]
seanmcl has joined #ocaml
ulfdoz has joined #ocaml
ygrek has joined #ocaml
joewilliams_away is now known as joewilliams
jcaose has joined #ocaml
ztfw has joined #ocaml
tmaeda is now known as tmaedaZ
Drk-Sd has quit [Ping timeout: 256 seconds]
Drk-Sd has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
ygrek has joined #ocaml
_unK has joined #ocaml
Gooffy has joined #ocaml
_unK has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 245 seconds]
ygrek has joined #ocaml
lokydor has joined #ocaml
Gooffy has quit [Quit: Leaving.]
ttamttam has quit [Quit: Leaving.]
f[x] has quit [Ping timeout: 260 seconds]
jcaose has quit [Ping timeout: 245 seconds]
<flux>
are there any digital audio signal processing libraries for ocaml?
* julm
only knows a small binding for ALSA
<flux>
I'm trying to a) synchronize two similar audio streams, b) find segments with beeping from stream A c) find the same (time-wise) beeps from stream B
<Camarade_Tux>
(still a complete beginner however)
<Camarade_Tux>
as far as I understand it (that may be completely wrong), a signal/behaviour (what is called continuous) are values for which there is a value at any point in time (it cuold be the space left on a drive)
<DaveS>
what do they mean by 'time'?
<Camarade_Tux>
on the other hand, an event does not always have a meaningful value: for instance a keystroke
<Camarade_Tux>
of course you could express events as signals with a value of None | Some 'a instead of an event of type 'a
<Camarade_Tux>
as for time, can't say for sure (and I think there are different "definitions")
<DaveS>
I'm guessing time refers to the current position in the event queue perhaps?
<DaveS>
ok it's arbitrary
<Camarade_Tux>
I don't think there's a "current" position, but you're already reaching the limits of my knowledge: I haven't started with FRP yet (should start later this week)
<DaveS>
"You define what time means to you (e.g. it
<DaveS>
could be the
<DaveS>
sucession of server request, the sucession of mouse inputs, etc.)."
DaveS has quit [Quit: leaving]
dmarkey has joined #ocaml
lokydor has quit [Ping timeout: 245 seconds]
lokydor has joined #ocaml
ztfw` has joined #ocaml
Submarine has quit [Ping timeout: 276 seconds]
ztfw has quit [Ping timeout: 245 seconds]
pimmhogeling has quit [Ping timeout: 245 seconds]
avsm has joined #ocaml
lokydor has quit [Ping timeout: 245 seconds]
threeve has quit [Quit: threeve]
avsm has quit [Quit: Leaving.]
yakischloba has joined #ocaml
Pepe_ has quit [Quit: leaving]
Ppjet6 has joined #ocaml
ztfw` has quit [Remote host closed the connection]