<mrvn>
thelema: I might have gone with while [ $# -gt 0 ]; do echo "$1"; shift; done
tmaedaZ is now known as tmaeda
<mrvn>
thelema: usefull for the more general case where you need to use them in pairs or the like.
<mrvn>
thelema: or to first consume all args starting with -
<thelema>
mrvn: You're welcome to add that third answer, although the first answer was exactly what I was looking for, and the second explained me a ton on what was going on
* Leonidas
likes the bash wiki, actually.
<Leonidas>
answers 99% of all questions
<thelema>
As long as it's googlable, I'm happy
ikaros has quit ["Leave the magic to Houdini"]
<Leonidas>
ist there somewhere a list of standard ocaml exeptions?
<mrvn>
thelema: I should ask that site how to create a ('a, 'a -> unit) list so that the 'a for individual elements of the list can be anything.
<thelema>
mrvn: you may get an answer
<mrvn>
I got one from the ML but it is pretty tricky to do.
<flux>
leonidas, maybe the manual has a list? if not, you can get some idea with: grep '^exception' `ocamlc -where`/*.mli
<ski_>
i'm not sure how it is denoted, but it's basically of type (some 'a. 'a * ('a -> unit)) list
<mrvn>
What I actualy wanted was more like type 'a foo = { mutable x : 'a; on_read : 'a foo -> unit; on_write : 'a foo -> unit }
<mrvn>
A record of unspecified type with a bunch of callbacks and then you have a list or queue or hashtbl or whatever of them.
<ski_>
and then you wanted to hide the type 'a ?
<mrvn>
exactly.
<Leonidas>
Reference to undefined global `Ha6'
<Leonidas>
When I Open Ha6 in my test_ha6.ml file.
<Leonidas>
I guess I need some compilation option.
<ski_>
can you write type foo = { ... 'a ... } ?
<Leonidas>
or du I need to write an mli file?
<ski_>
(istr HBC used that for baking an existential into a new datatype)
<mrvn>
The simplest solution is something like let make x on_read on_write = let x = ref x in { on_read = on_read x; on_write = on_write x; } but then you create lots of closure.
<mrvn>
The better (as in no closures) solution is too long for me to remember now.
<ski_>
is it in the manual, somewhere ?
Yoric has quit [Read error: 110 (Connection timed out)]
Yoric_ is now known as Yoric
<mrvn>
ski_: if you can derive it from the grammar :)
<Leonidas>
any idea what I need to add to my OMakefile to make test_ha6.ml find ha6.ml?
<mrvn>
ski_: For extra homework write an universal container type where you can iterate over elements matching a type.
<mrvn>
ski_: i.e. in [(1, print_int); ("foo", print_string)] iterator over only the ints.
Associat0r has quit []
ua has quit [Read error: 113 (No route to host)]
<ski_>
that sounds evil
<mrvn>
perfectly typesafe
<ski_>
what if i export a type `foo' abstractly, that is currently represented as `int' ?
<ski_>
should the (aFoo, print_foo) pair be invoked ?
<mrvn>
ski_: then you are exporting type `foo abstractly, that is currently represented as `int'
<mrvn>
ski_: That depends on how you write your code
<mrvn>
ski_: But with an abstract type you should not be able to tell that it is an int in the type system.
<ski_>
exactly
<ski_>
(and i would expect to not be able to tell at run-time, either (possibly modulo debugging tools))
Narrenschiff has quit [Read error: 60 (Operation timed out)]
<mrvn>
ski_: each item in the container could have a "is_type : type_t -> bool" method. If is_type `Int gives true for your foo then it would be called.
<mrvn>
ski_: That would be runtime checking though.
<ski_>
`Int just being a polymorphic variant constructor ?
<mrvn>
ski_: sure
<mrvn>
just an example
<ski_>
(so `type_t' doesn't magically contain all types, then ..)
<ski_>
*nod*
<mrvn>
ski_: if you get it to work magically you get extra points. :)
ski_ has quit ["Lost terminal"]
ski_ has joined #ocaml
_unK has joined #ocaml
jimmyb2187 has left #ocaml []
ikaros has joined #ocaml
Yoric has quit [Remote closed the connection]
tmaeda is now known as tmaedaZ
Yoric has joined #ocaml
dmentre has quit ["Leaving."]
middayc has joined #ocaml
jimmyb2187 has joined #ocaml
ttamttam has quit ["Leaving."]
_zack has quit ["Leaving."]
det has quit [Remote closed the connection]
det has joined #ocaml
<Camarade_Tux>
I used git stash, anyone know how I can see the corresponding changes now? (without applying the stash)?
<thelema>
gitk --all
<thelema>
I run this command *all* *the* *time*
Yoric has quit []
<Camarade_Tux>
helps you see how dirty your branches are :P
<thelema>
it shows me the repo. I don't think I could use git effectively without it.
<Camarade_Tux>
ok, thanks, I think I'll apply the stash and commit selectively a few things from this which are fixes
<Camarade_Tux>
I'll see if I can get poppler-glib bindings out of ocaml-gir ;-)
<Camarade_Tux>
gotta, be back later :)
lutter1 has joined #ocaml
lutter has quit ["Leaving."]
<mfp>
Camarade_Tux: git stash show -u
<thelema>
mfp: I figured there was a better way. I just didn't know what it was.
smimram has quit ["bli"]
Submarine has joined #ocaml
ua has joined #ocaml
smimou has joined #ocaml
ttamttam has joined #ocaml
ulfdoz has joined #ocaml
Amorphous has quit [Read error: 113 (No route to host)]
Amorphous has joined #ocaml
Submarine has quit [Read error: 54 (Connection reset by peer)]
Submarine has joined #ocaml
middayc has quit ["ChatZilla 0.9.85 [Firefox 3.5.5/20091102152451]"]
Smerdyakov has joined #ocaml
Snark has joined #ocaml
<mfp>
good afternoon gentlemen
_andre has quit ["*grabs*"]
<thelema>
hi mfp
<mfp>
here's the initial version of the OCaml dynamic loader I've hacked over the last 2 days > http://github.com/mfp/ld.ocaml
<thelema>
I've been stuck in C++ land over the last few hours. I wanna escape!
_JusSx_ has joined #ocaml
<mrvn>
thelema: condolences
<thelema>
thank you.
<thelema>
I'm trying to figure out ld.ocaml - how does it get invoked when a library needs to be loaded?
<mfp>
you compile the program with shared, and then do ld_ocaml foo.cmxs
<mfp>
ld_ocaml looks for all the .cmxs in the sys and loads those needed by foo.cmxs
<thelema>
your compiled program is foo.cmxs?
<mfp>
yes
<thelema>
ok, that makes more sense.
<mfp>
instead of doing e.g. ocamlfind ocamlopt -package aaa -o foo foo.ml -linkpkg you do ocamlfind ocamlopt -package aaa -o foo.cmxs foo.ml
<thelema>
How is it done automatically in C - does the compiler put in the calls to ld?
<mfp>
no -linkpkg in the latter, -package is only needed to let the compiler see the .cmis
<mfp>
in C the program is loaded by ld.so
<mfp>
it's exactly the same as ld.ocaml, hence the name
<mfp>
"ld.so loads the shared libraries needed by a program, prepares the program to run, and then runs it. Unless explicitly specified via the -static option to ld during compilation, all Linux programs are incomplete and require further linking at run time."
<thelema>
so bash automatically runs ld.so for you for C programs?
<flux>
mfp, hmm.. so that's basically shared libraries for ocaml then?
<mfp>
yes
<flux>
mfp, pretty nifty!
<flux>
would it work with .cmo-files?
<flux>
(the approach you've taken)
<mfp>
yes
<flux>
that might be useful too, because one thing that can prevent using ocaml in embedded platforms is the size of binaries
<mfp>
would use ocamlobjinfo (or the code the latter uses) to extract info about the imported .cmi and .cmo files
<flux>
..and you might not be able to compile natively for such
munga_ has joined #ocaml
<mfp>
the dep resolution mechanism is generic, could easily be functorized over a module with ~ 3 functions to 1) look for libs 2) extract info from an object 3) load an object
Snark has quit ["Ex-Chat"]
Associat0r has joined #ocaml
_JusSx_ has quit ["leaving"]
<Camarade_Tux>
mfp: good to know, thanks :)
sramsay has joined #ocaml
Waleee has quit [Read error: 110 (Connection timed out)]
ulfdoz has quit [Read error: 60 (Operation timed out)]
ski_ has quit ["Lost terminal"]
ikaros_ has joined #ocaml
davidL has joined #ocaml
ikaros has quit [Read error: 104 (Connection reset by peer)]
davidL has left #ocaml []
ttamttam has quit ["Leaving."]
tmaedaZ is now known as tmaeda
Submarine has quit ["Leaving"]
det has quit [Remote closed the connection]
Yoric has joined #ocaml
albacker has quit [")"]
lutter1 has quit ["Leaving."]
lutter has joined #ocaml
subito has quit [Read error: 113 (No route to host)]
ikaros_ has quit ["Leave the magic to Houdini"]
lutter has quit ["Leaving."]
sramsay has quit [Read error: 110 (Connection timed out)]