<dark>
I'm not sure exactly which type is this. isn't this a record, and not an object?
caligula has quit [Quit: Konversation terminated!]
<_habnabit>
#i is the interface; I'm defining a record.
<_habnabit>
the actual record has more fields, but this demonstrates the problem.
<dark>
#i ? I'm confused
<_habnabit>
class type i = ...
<dark>
but, you can't define a record partially, because records with matching fields can't be composed
<dark>
records in ocaml doesn't use row typing, unlike objects
<_habnabit>
'row typing' ?
<dark>
like, selecting "all records/objects with this given field/method"
<dark>
in fact you can't have two records with the same field
<dark>
< bar : int; .. > is a type that includes a set of object types, there is no record analogue for this
<_habnabit>
yeah, but I want < bar: int >
<_habnabit>
without the ; ..
<_habnabit>
or does that not matter/
<_habnabit>
?
<dark>
then why you are defining it with { }?
<flux>
_habnabit, how about you drop the # ?
<_habnabit>
flux, I'll try that; one sec.
<_habnabit>
dark, eh? I have a class type and a record type both.
Associat0r has quit [Client Quit]
* dark
didn't understand the type { x : #i } to begin with
<flux>
_habnabit, the trick is to put stuff in like: { x = (new someclass :> i) }
<flux>
_habnabit, obviously you won't be able to access anything someclass has but i doesn't
<dark>
but, uhm, #i is "classes compatible with i", right?
<_habnabit>
flux, that's prefectly okay.
<flux>
but if you were able to do that, the type ot t would be different, right?
<flux>
so for those occasions you would is 'a t = ..
<_habnabit>
oh, I see. #i vs. i appends the ;.. or not?
<flux>
dark, I think it as "any class that is i or a superset or i"
<flux>
OF i, not or i
* _habnabit
tries.
<dark>
oh, now I see why { x : #i } is polymorphic
<_habnabit>
ah, that does solve it. excellent.
<flux>
great. now I get to make breakfast :).
<_habnabit>
of course, this is all a moot point. I was switching from using a module-based interface to using an object, and it introduced something like two orders of magnitude of slowdown.
<_habnabit>
and that's... not optimal.
<dark>
methinks that mixing objects and records is ugly
<_habnabit>
so now I'm going to try a functorial interface and 3.12's first-class modules.
dnolen has quit [Quit: dnolen]
caligula has joined #ocaml
<flux>
I guess objects are going to be the slowest way, whereas records and functors would have the same performance
<flux>
(invoking a method involves a search, which is cached in local scope sure but still it's a hit)
bobry1 has joined #ocaml
larhat has joined #ocaml
Tianon has quit [Ping timeout: 264 seconds]
edwin has joined #ocaml
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
itewsh has joined #ocaml
edwin has quit [Remote host closed the connection]
Eataix has joined #ocaml
avsm has joined #ocaml
edwin has joined #ocaml
avsm has quit [Quit: Leaving.]
ankit9 has quit [Ping timeout: 276 seconds]
<flux>
ooh, a new toplevel. I should read the channel backlogs as well, bumped on it from caml-list
<larhat>
maybe, autogenerated project home pages with links to files are good idea?
<f[x]>
maybe, but the forge feature request to autogenerate such pages is already year old :)
* f[x]
for himself does copypaste index.html
hto has quit [Read error: Connection reset by peer]
hto has joined #ocaml
betta_y_omega has quit [Ping timeout: 260 seconds]
betta_y_omega has joined #ocaml
<larhat>
utop is blinking in my iterm! that's annoying, is it a bug?
jimmyrcom has quit [Ping timeout: 258 seconds]
<diml>
larhat: try with TERM=linux
<larhat>
diml: thanks, that fixes blinking and adds more colors
<diml>
larhat: what is the contents of your TERM ? i need to add it to lambda-term
<larhat>
diml: echo $TERM
<larhat>
xterm
<diml>
hmmm
<larhat>
with standard macosx terminal i have TERM=xterm-color and utop works just fine
<diml>
there is a rule for xterm-color in lambda term
<diml>
the problem is that most terminals announce themselves as xterm and support 16 colors (and even 256 most of the time)
<adrien>
I've been having a lot of fun with colours in vim: when I start vim, I get some colours and as soon as I do something in the window, the colours shift (like yellow -> dark yellow (which is actually brown))
peddie has left #ocaml []
<foocraft>
Syntax highlighting with all its perks!
<foocraft>
I don't understand why people get so sensitive about color. (pun)
<adrien>
because some are nicer on my eyes than others ;-)
<adrien>
I actually had to tweak colours so that it played nicely with my screen's subpixels: RGB; if you light R and B while keeping G off, and with G being wider than others, you actually see R BR BR B which you (at least I) see as "BR BR", and a doubled one ;-)
ftrvxmtrx_ has quit [Read error: Connection reset by peer]
ftrvxmtrx_ has joined #ocaml
avsm has joined #ocaml
lopex has joined #ocaml
jimmyrcom has joined #ocaml
dark has quit [Remote host closed the connection]
lopex has quit [Ping timeout: 252 seconds]
lopex_ has joined #ocaml
jimmyrcom has quit [Ping timeout: 240 seconds]
<foocraft>
In the 1938 Warner Brothers cartoon directed by Robert Clampett, "The Daffy Doc", a very early version of Daffy Duck holds up a sign saying "SILENCE IS FOO!" `FOO' and `BAR' also occurred in Walt Kelly's "Pogo" strips.
ccasin has quit [Ping timeout: 258 seconds]
dnolen has joined #ocaml
<hcarty>
flux: I've used (and I use!) utop a lot now
<hcarty>
flux: It's quite nice, and installable with odb, given a small amount of extra effort.
<flux>
hcarty, nice. I guess I should try it.
julm has joined #ocaml
<hcarty>
flux: It's a step up from lwt-toplevel, if you're used that before
<flux>
well, it was on my to-do-list as well 8-)
<hcarty>
Skip it for utop :-)
<flux>
I guess I was only an execcute away on debian from it..
<flux>
utop is going to be more effort :)
<hcarty>
They are similar, but utop has better context-sensitive completion
<flux>
did you try the emacs integration?
<hcarty>
That is true I suppose.
<hcarty>
I have not
<olasd>
I was looking into packaging utop, that shouldn't be too hard (well, zed and lambda-term need to be packaged first...)
<olasd>
i'll look closer tonight
<flux>
olasd, I can test your packages :)
<flux>
olasd, which distribution were you thinking of targeting, btw?
<larhat>
i've just installed utop, and it's nice. i'm also tried utop in emacs, but it doesn't have completion there.
<zorun>
oh, cool, I didn't know utop
<zorun>
and there's a package for archlinux \o/
Eataix has joined #ocaml
lopex_ is now known as lopex
BiDOrD has quit [Ping timeout: 264 seconds]
<hcarty>
gildor: An oasis-db request - if/when the data currently driving
<hcarty>
gildor: the odb/oasis-db site is wiped, it would be useful to have a dump of all of the existing packages available.
<hcarty>
gildor: That would allow a few of us to quickly re-populate the next version/replacement
<thelema>
hcarty: it should be just a matter of re-uploading the tarballs
<thelema>
modulo the main download location for each tarball
<hcarty>
thelema: Yep. It would be handy to have a collection of those tarballs all together to speed up the process.
<hcarty>
Not needed, but handy.
<thelema>
it should be straightforward to do a 2-stage spider of oasis-db starting with the 00list file to get a list of packages, then read each package info file to get a tarball url, and finally get each tarball
<thelema>
without gildor's cooperation
<hcarty>
Just warning ahead of time
* thelema
thinks he'll spend some time setting up such a mirror today
mnabil has quit [*.net *.split]
mnabil has joined #ocaml
<avsm>
sigh. more endless messing around with ocamlbuild
<avsm>
today, trying to spot how to do -output-obj
<f[x]>
ocamlbuild is for _common_ tasks
<avsm>
i've almost got a full parallel test harness working in it using dynamic build rules
<avsm>
it's great when writing custom rules, or using the built-in ones
<avsm>
but trying to override the built-in ocaml ones, now thats hell on earth
<f[x]>
yeah, there is some ugly magic and some bugs :)
<f[x]>
you could start with empty set of rules, but that means writing (copypasting) many more rules
<avsm>
its more than copy pasting; it's pretty much the whole of ocaml_* in the ocamlbuild source i'm afraid. Those rules are *really* impressive :)
<avsm>
like camlp4, the tool is pretty awesome in its power, just a bit obscure
<adrien>
the more I have to use Qt, the more I hate it and the more I wonder how it'd be through ocaml bindings
Eataix has quit []
<flux>
I'm thinking it could not possibly be any worse
<flux>
I mean: lambda functions!
dnolen has quit [Quit: dnolen]
avsm has quit [Ping timeout: 264 seconds]
lopex has quit []
<bobry1>
zorun: yeah, i've failed to compile lwt-toplevel as well. this looks like an issue with lwt _oasis file
<bobry1>
zorun: as for site-lib, it's a known Arch issue, see https://wiki.archlinux.org/index.php/OCaml_Package_Guidelines « Libraries were previously installed under /usr/lib/ocaml or /usr/lib/ocaml/site-lib, depending on the package. This mixture prevented some packages from working with others and fragmented OCaml development on Arch Linux. The use of /usr/lib/ocaml/site-lib has therefore been discontinued.»
bobry1 has quit [Quit: Leaving.]
avsm has joined #ocaml
jimmyrcom has joined #ocaml
BiDOrD has joined #ocaml
<thelema>
gdb backtraces on unpatched ocamlopt binaries -- are they just wrong?
<edwin>
thelema: if you just want backtraces for ocaml exceptions you don't need gdb. For crashes at least the top function should be ok
<edwin>
thelema: with a slightly different function name, I think ocamlopt appends a suffix to them
<edwin>
thelema: how does your backtrace look like?
<thelema>
I have a backtrace that goes (in reverse order) A ? B C ?????? A ? B C ?????? ... and I can't see my code going from C to A
<thelema>
I can tell the function names have the format: caml<modulename>__<functionname>_<number>
<thelema>
edwin: This backtrace was obtained via the poorman's profiler. I still have the process suspended, if you can think of something to do to it.
<edwin>
are you sure the backtrace is output in right order
<edwin>
fold calls join2, so if you read bottom up its good
jimmyrcom has quit [Ping timeout: 260 seconds]
<edwin>
hmm but right List.fold_left is not good
<thelema>
fold_left doesn't call join2, it calls star_tern
<edwin>
well it evaluates rs which calls join2
<thelema>
I shouldn't have anything between the recursive calls to lrmerge -- it calls itself directly
<edwin>
but I'd expect that to be done prior to calling fold_left
<f[x]>
thelema, they are not reliable
<thelema>
edwin: yes, it should be.
<edwin>
so maybe what you see is some data saved to stack
<edwin>
some closures
<f[x]>
gdb doesn't have enough info to unwind correctly and so it takes everything from the stack (local vars etc) and tries to interpret as return addresses
<edwin>
incorrectly interpreted as return addresses
avsm has quit [Quit: Leaving.]
<f[x]>
you can x/40a $rsp
<thelema>
f[x]: that makes much more sense.
<edwin>
does ocamlopt produce dwarf unwind tables?
<f[x]>
and get almost the same
<thelema>
"x/40a $rsp"?
<edwin>
if not you're lost on 64-bit anyway as there is no stack frame
<f[x]>
edwin, PR#5314 :)
<f[x]>
actually on 64bit it is usually better
larhat has quit [Quit: Leaving.]
<f[x]>
thelema, "help x" if you are curious
* thelema
thinks he'll try f[x]'s patch
<edwin>
anyway for profiling the top function should be reliable, just not the callgraph
<f[x]>
not if you can't map it to location in the code where it is called :)
<f[x]>
also you can't profile memory allocation with only top frames
ulfdoz has joined #ocaml
* thelema
really wants to know memory allocation, as his program is growing to take >16GB in some orderings.
mnabil has quit [Ping timeout: 276 seconds]
<thelema>
f[x]: I assume bootstrapping isn't needed for your CFI patch, right?
<f[x]>
no
<f[x]>
sometimes simply objsize'ing the handful of suspects is enough
mdelaney has joined #ocaml
<thelema>
any suggestions for finding where compare_val is being over-called?
<f[x]>
run in gdb, set breakpoint on compare_val and collect traces
mdelaney has quit [Read error: Connection reset by peer]
mdelaney_ has joined #ocaml
ttamttam has quit [Remote host closed the connection]
<thelema>
f[x]: compare_val's backtrace only goes back a bit: 1 caml_equal,caml_c_call
jimmyrcom has joined #ocaml
joewilliams is now known as joewilliams_away
joewilliams_away is now known as joewilliams
ulfdoz_ has joined #ocaml
oriba has joined #ocaml
Anarchos has joined #ocaml
ulfdoz has quit [Ping timeout: 276 seconds]
ulfdoz_ is now known as ulfdoz
<edwin>
thelema: did you try profiling the bytecode?
<edwin>
memory usage shouldn't differ much
mdelaney_ has quit [Quit: mdelaney_]
mdelaney has joined #ocaml
<thelema>
edwin: I haven't - my next step in profiling would be to add some instrumentation on object sizes to the objects in the main loop
<edwin>
thelema: did you try ocamlviz?
<edwin>
I think it can show some GC stats realtime, and some object stats
joewilliams is now known as joewilliams_away
joewilliams_away is now known as joewilliams
<thelema>
I've not had good luck with tagging values and having it compute the size of those values, but I will try using it to be able to watch some object size counts
mdelaney has quit [Ping timeout: 268 seconds]
mdelaney has joined #ocaml
chambart has quit [Ping timeout: 258 seconds]
itewsh has quit [Quit: o/]
chambart has joined #ocaml
sgnb has quit [Remote host closed the connection]
<_habnabit>
can you make a .ml file a functor?
<_habnabit>
or do you have to make a functor within a .ml file?
<thelema>
_habnabit: within
<Anarchos>
_habnabit within a ml file
<_habnabit>
ah, dang.
<Anarchos>
which leads to awful A.A5B)
<Anarchos>
A.A(B)
<thelema>
and "Map.Make(S)"
sgnb has joined #ocaml
<_habnabit>
when defining `module type X = sig ... end`, how can I specify that there should be a module defined of a particular type?
<_habnabit>
doing just `module M = Some_module_type` in the sig gives an error.
<thelema>
module type X = sig module M : Some_module_type end
jimmyrcom has quit [Ping timeout: 240 seconds]
<_habnabit>
aha. thanks!
ankit9 has quit [Quit: Leaving]
pdhborges has joined #ocaml
lopex has joined #ocaml
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
pdhborges has quit [Quit: Leaving.]
<Anarchos>
thelema i have a module defining a type term. I want a mly parser of type string -> term, how can i do ?
<thelema>
Anarchos: %type <Module.term> parser
<thelema>
%type <Ns_types.str_spec_t> spec
<Anarchos>
yes but how to include this parser within the module ?
<thelema>
within the module defining that type?
<Anarchos>
yes
<thelema>
the parser will depend on the module with the type - I think it can't go into that module without a circular dep
<Anarchos>
thelema yes i guess, but i want to hide details to user for security reason, but give them a parser
<_habnabit>
'security', heh.
<_habnabit>
if you want security, don't give them code.
<Anarchos>
_habnabit yes my code is a math verifier so i don't want user to trick it
<thelema>
Anarchos: module Base_term = ... module Parser = ... %type <Base_term.term> parser ... module Term = include Base_term
pdhborges has joined #ocaml
<thelema>
and apply the right .mli to term.
<Anarchos>
thelema seems rather a good compromise
<Anarchos>
thelema i was thinking to use menhir to generate the parser
<Anarchos>
thelema but your solution is better
<thelema>
you can still use menhir
<thelema>
just hoist its output into another file.
<thelema>
module Parser = sig <contents of menhir output file> end
chee1_ is now known as chee1
<Anarchos>
thelema teh include is perfect for me
jimmyrcom has joined #ocaml
pdhborges has quit [Quit: Leaving.]
jimmyrcom has quit [Read error: Operation timed out]
jamii has joined #ocaml
jimmyrcom has joined #ocaml
<alpounet>
wow, Adam's gonna teach at MIT
<zorun>
Adam?
ftrvxmtrx_ has quit [Quit: Leaving]
<zorun>
why does utop requires ocaml-compiler-libs?
<zorun>
I've never seen that dependency before
<hcarty>
zorun: I don't think that the toplevel bits are normally exposed
<zorun>
ok, thanks
<hcarty>
Anything messing with the toplevel directly will presumably need to link with core pieces of OCaml
<hcarty>
zorun: No problem. My guess is that this is, in part, because of the license differences (LGPL vs QPL)
<zorun>
what are the licenses doing here?
<zorun>
oh, OCaml itself is QPL and its libs are LGPL?
<thelema>
zorun: yes
<adrien>
compiler is QPL, stdlib is LGPL+static linking exception
jimmyrcom has quit [Ping timeout: 260 seconds]
<adrien>
zorun: Adam Chipala (or almost), aka Smerdyakov, a channel operator
mfp has quit [Remote host closed the connection]
<zorun>
adrien: ok
mfp has joined #ocaml
<adrien>
is it possible to define a class inside another class?
<Anarchos>
adrien it should
jamii has quit [Ping timeout: 258 seconds]
<hcarty>
adrien, Anarchos: I don't think a class can - I think they are limited to value definitions and methods.
<Anarchos>
hcarty you might be right
<adrien>
doesn't seem like it was possible
<dsheets>
How would you reference a member class?
<thelema>
dsheets: you can't - it'd be local, like a nested function
<adrien>
that code is getting so verbose with only boilerplate code that I'm probably going to have a code-generator for it
<dsheets>
thelema: so then why is nesting needed instead of module encapsulation or some other hiding technique?
<thelema>
adrien: I hope you're doing things wrong
<adrien>
dsheets: I don't want state in modules
<dsheets>
adrien: a class definition has state?
<adrien>
thelema: it's actually meant to be boilerplate code, a kind of adaptation between a persistant data structure and lablgtk-react code
<_habnabit>
if I have, say, `class integer i = object val i = i end`, how could I make a method `plus` that returns a new integer that sums two integers?
<adrien>
dsheets: the object has
<_habnabit>
actually maybe I should try to make a minimal example of my whole problem first ...
<_habnabit>
hm
<hcarty>
_habnabit: ... method add x = {< i = i + x >} ... or something along those lines may do what you want
<_habnabit>
hcarty, right, but if it takes an integer. not an int.
<_habnabit>
my example class name is not good. :(
<hcarty>
_habnabit: ... method add x = {< i = i + x#i >} ... but i needs to be a method in that case, or have an accessor
<_habnabit>
is an accessor different from a method?
<_habnabit>
well, I'm not picky. is this simpler some other way?
<thelema>
_habnabit: yes parse is unhappy, you're returning two different types
<_habnabit>
right.
<thelema>
you have to explicitly cast to number
<thelema>
the types of int_wrap and float_wrap don't unify.
<thelema>
you're expecting them to unify to number
<_habnabit>
not really; I know this doesn't work. I'm just trying to figure out how to structure this.
<_habnabit>
that's really just a demonstration of what I'm trying to accomplish.
<thelema>
also, I don't think you can go from string to 'a number.
<_habnabit>
in short, I have a common public interface that I'm trying to expose.
<_habnabit>
and different implementations of that interface.
<_habnabit>
but the actual implementation requires things like the plus method.
<_habnabit>
the operation isn't defined between two objects with different implementations.
<adrien>
thelema: I think that http://vpaste.net/4HpqT?ft=ocaml is close to how I want the code to work, it can most probably be improved but it's probably to remain that repetitive (and, 1- yes I suck at naming, even more at 11pm, 2- yes it's quite ugly)
<_habnabit>
but yeah, I'm just unsure how to structure this.
<adrien>
and bedtime for me!
<_habnabit>
(I mean, could this be done with a functorial interface instead?)
<thelema>
adrien: why the extra indirection?
<adrien>
thelema: because there will be several "pouetpouet"
<adrien>
the id is supposed to be a unique identifier to be used in some code that will be the mirror of this one and can be used to filter messages
<thelema>
_habnabit: mixing functors and objects is icky. I'd try to make an abstract class and use (new foo :> #abstract_class_name) to cast
<_habnabit>
thelema, no, I wouldn't be mixing them. I'm fine with doing this entirely one way or the other.
<thelema>
adrien: hmmm. It'd probably help if I knew more about React
<thelema>
_habnabit: type number = Int of int | Float of float let add a b = match a,b with Int a,Int b -> Int (a+b) ...
<_habnabit>
thelema, hmm
<thelema>
if you're just using objects to get tags on your types so the right operations are performed on them, there's a simpler way: variant types
<thelema>
s/types/values/
<adrien>
it's actually not that hard, it's a transposition of the usual stuff for data ('a list) to events ('a React.event), and instead of going over a list of 'a with map, you go over a succession of events which are often generated over time
<_habnabit>
thelema, I'm trying to think of how variant types are the wrong solution here, but you may be right. let me block on this for a minute.
<adrien>
that's not meant to be a complete description but FRP is mostly what we are used to but in a slightly different context
_andre has quit [Quit: leaving]
<thelema>
adrien: sounds like fun
sebz has joined #ocaml
<adrien>
and now, good night for real, I'll probably find issues with this code tomorrow and if not, I'll be pretty much done with the design and core implementation of lablgtk-react, which, I hope, is going to be fresh air for GUI stuff :-)
<adrien>
(mostly, decoupling UI stuff from other things, with native ocaml data structures)
<NaCl>
adrien: yay handwriting recognition
<adrien>
\o/
<adrien>
(wikipedia is the worst thing to load before trying to go to bed)
<NaCl>
heh
<NaCl>
ugh
* NaCl
was considering making one
edwin has quit [Remote host closed the connection]
<_habnabit>
hmm. no matter how I try to approach this, it seems like I tell the type system to discard information and then can't recover it.
<thelema>
_habnabit: which is where the tags are necessary - you have to keep that type information as a tag stored at runtime.
<_habnabit>
tags?
<thelema>
objects have them, variant types have them
<thelema>
for variant types, it's simple - just some bits in the header
<thelema>
(or is it an entire word?)
<_habnabit>
oh, you mean `type 'a foo = ...` ?
<_habnabit>
or something else?
<thelema>
not at all
<thelema>
variant types: type foo = L of int | R of float
<thelema>
ocaml's variant types are tagged unions (if you know C)
<_habnabit>
ah.
<_habnabit>
and classes do something different?
<Anarchos>
thelema i have two includes in fact in your solution : include Base_Term include Parser, right ?
<thelema>
classes have a runtime tag so they know what class they are
<_habnabit>
ah, I see.
<thelema>
Anarchos: it's probably sufficient to use one include and just copy the single parsing function into your namespace
<thelema>
Anarchos: let parse = Parser.parse
<Anarchos>
thelema oh nice
<Anarchos>
indeed you are really skilled to find good solutions !
<thelema>
I've just been around a while.
<Anarchos>
i know
<thelema>
I wish I could figure out how I was getting an Invalid_argument exception from a line of code that calls a function that doesn't raise anything (or call invalid_arg)
<thelema>
same location in native code or bytecode exception
<Anarchos>
thelema did you debug the code ?
<thelema>
Anarchos: by "debug the code" do you mean run in ocamldebug?
<Anarchos>
yes
<thelema>
no, but I think I've got it bracketed to one place.
<thelema>
apparently ISet isn't as complete as I hoped.
<thelema>
(0,255) - (0,5)(6,6)(7,255) dies with a crazy error
<thelema>
oh, the set isn't being created properly
<Anarchos>
thelema just investigate now :)
det has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
* thelema
found the bug - two letters transposed in IMap