<_y_>
hi folks, I'm trying to implement a custom toplevel and I'm having a few issues with it
<_y_>
basically what I did was build OCaml from source, then implement a wrapper around Toploop.loop which sets Toploop.read_interactive_input to a function that I control, and I'm playing with some contrived examples to see exactly how things behave
<_y_>
I notice that when my read_interactive_input replacement returns 'true' in the second position of its pair return value, this causes the interpreter to quit immediately after executing a statement, but it does print out "0\n", as expected
<_y_>
if instead I return 'false' in the second position, the interpreter processes both statements, but doesn't actually print any values (it just prints "- : unit = ()" twice)
<_y_>
anyone have any insight into this?
<orbitz>
over my head!
<_y_>
oh, it turns out that I can attribute my mistake to sleep-deprivation
<_y_>
sorry; disregard the above, and thanks anyway
<_y_>
and congratulations to me, because it actually works!
<mjuad>
:D
Edward__ has quit []
_y_ has quit []
ftrvxmtrx has quit [Ping timeout: 240 seconds]
elehack has joined #ocaml
ftrvxmtrx has joined #ocaml
Axsuul has joined #ocaml
<Axsuul>
Hmm.. type ('foo, 'bar) blah = Foo 'boo | Bar 'bar
<Axsuul>
I don't get what the 'foo and 'bar in the parentheses mean
<Axsuul>
why not just
<Axsuul>
type 'foo blah = Foo 'foo | Bar 'foo
elehack has quit [Ping timeout: 260 seconds]
mfp has quit [Ping timeout: 245 seconds]
<orbitz>
Axsuul: because 'foo and 'bar can be different types
<orbitz>
'foo is the same type in your second code
mfp has joined #ocaml
elehack has joined #ocaml
oriba has quit [Quit: Verlassend]
<Axioplase_>
Axsuul: write the type declaration, and then "(Foo 42, Bar 3.1415)" without the quotes
<Axioplase_>
Then, try "type 'foo otherblah = Foo 'foo | Bar 'foo" and again "(Foo 42, Bar 3.1415)"
<Axioplase_>
(hum, renaming the constructors Foo to Foo2 and Bar to Bar2 may be useful if you do it in the same program/REPL)
<Axsuul>
orbitz: thanks
<Axsuul>
Axioplase_: alright ill try that.. in a sec. eating :)
<Axioplase_>
(I'll take a break, then lunch, and might not answer soon. The point is you trying to use say, one or two parameters with declarations, and then compare the types of several instances. The meaning of the constraints should then be clear to you)
wuj has quit [Ping timeout: 265 seconds]
jakedouglas has quit [Quit: Leaving.]
elehack has quit [Quit: not a typewriter]
petabit has joined #ocaml
mjonsson has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
<Axsuul>
argghh, still having trouble getting types
<Axsuul>
say i still did this
<Axsuul>
but i wanted to add types
<Axsuul>
type ('foo, 'bar) blah = Empty | Foo of 'foo | Bar of 'bar | Seq of 'foo * 'bar
<Axsuul>
so i could do this
<Axsuul>
Seq [Foo "hello"; Bar "world"]
<flux>
try: type ('foo, 'bar) blah = Empty | Foo of 'foo | Bar of 'bar | Seq of ('foo, 'bar) blah * ('foo, 'bar) blah instead
<flux>
then this works: Seq (Foo "hello", Bar "world"
<adrien>
CityHunter_: hmmm, the issue is probably in pict actually
<adrien>
you should forward this to pict's author(s)
<CityHunter_>
adrien: thanks for the reply, I have already contacted the author, the project is outdated and that the author was able to help me
ftrvxmtrx has quit [Read error: Connection reset by peer]
ftrvxmtrx has joined #ocaml
<adrien>
ok, good :-)
_zack has left #ocaml []
<flux>
cityhunter_, now
<CityHunter_>
flux: I'm sorry, I must go away, come back in an hour
<flux>
I imagine it'd be much preferable if the source was updated. it's only 10+ years old :).
Yoric_ has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric_ is now known as Yoric
Yoric has quit [Read error: Connection reset by peer]
ygrek has quit [Ping timeout: 245 seconds]
yezariaely has joined #ocaml
Axsuul has quit [Ping timeout: 250 seconds]
Snark_ has joined #ocaml
Yoric has joined #ocaml
Yoric_ has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric_ is now known as Yoric
Yoric_ has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric_ is now known as Yoric
wuj has joined #ocaml
Yoric_ has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric_ is now known as Yoric
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
Amorphous has quit [Ping timeout: 252 seconds]
Yoric_ has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric_ is now known as Yoric
Yoric has quit [Read error: Connection reset by peer]
Amorphous has joined #ocaml
Yoric has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
<CityHunter_>
I am, I'm back
<CityHunter_>
flux: the source pict is very old, but I have no other solution. I am obliged to work with this language.
<flux>
cityhunter_, how about trying to find an older ocaml compiler to match?
boscop has quit [Read error: Connection reset by peer]
<CityHunter_>
I have not tried it with an older compiler
boscop has joined #ocaml
bohanlon has joined #ocaml
<flux>
the only issue I see with that is that the older environment might itself not work greatly in modern (say, x86-64) environments
<flux>
I guess bytecode should still work
<CityHunter_>
I do not know what to do, I'm discouraged
petabit has quit [Ping timeout: 265 seconds]
<gildor>
# int_of_string "2147483647";;
<gildor>
Exception: Failure "int_of_string".
<gildor>
CityHunter_: ^ ^ ^
<gildor>
CityHunter_: are you compiling on 32bits platform ?
<gildor>
CityHunter: long M = 2147483647; in Lib/Std/Random.src
petabit has joined #ocaml
<gildor>
CityHunter_: I think the error is from here
<gildor>
CityHunter_: if you compile using 64bits platform you won't have this problem
<CityHunter_>
uname -a 2.6.26-2-686
<gildor>
CityHunter_: this is it ;-)
<gildor>
try to compile on amd64/x86_64
<gildor>
# int_of_string "2147483647";;
<gildor>
- : int = 2147483647
<gildor>
on amd64
<flux>
I had a similar bug lately
<flux>
you'd think Random.int max_int is safe, but it's not..
munga has quit [Ping timeout: 276 seconds]
drksd has joined #ocaml
jonathandav has quit [Ping timeout: 276 seconds]
<gildor>
CityHunter_: I was able to compile pict wo pb on my computer
<gildor>
(amd64)
<gildor>
Debian Sid
rks has quit [Ping timeout: 272 seconds]
ttamttam has quit [Ping timeout: 272 seconds]
<CityHunter_>
gildor: you run the sample files?
jonathandav has joined #ocaml
<gildor>
CityHunter_: how can I do that ?
<CityHunter_>
gildor: pict inside the folder is a folder of examples, you should start with a pict FILE.po ". / pict fle.pi. The tutorial is written so
<gildor>
I can run make inside the Examples/ directory
<gildor>
it generates lot of exec
<gildor>
I just run a program "escher"
<gildor>
it works
<CityHunter_>
ok, this is a good thing
<gildor>
but with the kind of computer I have, I don't see any difference
<gildor>
(i.e. it takes less than a video cycel to generate escher or xtree)
<CityHunter_>
ok, so I have to try on a 64bit?
<gildor>
CityHunter_: if you want to suceed ;-)
<gildor>
CityHunter_: you can also fix the integer
<CityHunter_>
in Random.src?
<gildor>
yes
<gildor>
remove the last digit, I think it can be ok
<gildor>
(for all the 2147483647 -> 214748364)
<gildor>
but this is just a guess, you should try to understand how it works to fix it
<CityHunter_>
ok
ikaros has joined #ocaml
<CityHunter_>
I have to get away, see you later
mbac has quit [Quit: 256 colors]
<orbitz>
can OCamlMakefile maek .mli files on the fly too?
<flux>
why would one want that?
<orbitz>
for now a lot of my mli files are just a straight ocaml -i foo.ml > foo.mli
<flux>
and you don't modify foo.mli?
<orbitz>
right now, no, i will in the future but i'm still working out the interface i want
<flux>
what's the use of having .mli then?
heller has joined #ocaml
<flux>
but no, OCamlMakefile doesn't seem to use -i anywhere
<orbitz>
because once i'm read to package it up all i'll have to do is turn of fthe part that makes .mli files
<orbitz>
ready*
<flux>
or, you could just ocamlc -i at that point
<flux>
well, truth to be told, I've had %.mli.template: %.ml rules in my Makefiles as well
<flux>
they can give a nice starting point
<flux>
if the design hasn't been up-front
<orbitz>
yeah i'm still sort of exploring how i want to solve this
<flux>
but basically once I generate the .mli-file, I format it nicely and maintain it manually from there on
<orbitz>
also, ocamlfind lists a makefile helper tool in its documetnation that i don't see in the latest version, do you know if there is an alternative?
<heller>
so, is there any GUI toolkit for ocaml?
<orbitz>
lablgtk
<orbitz>
i hear it's terriblet hough
<flux>
it comes with labltk and lablgtk
<heller>
i see
<flux>
I don't think lablgtk2 is more horrible than 'plain' gtk2?
<heller>
that is great :)
<heller>
i am planning on learning ocaml
<heller>
any cool ressources you can point me to?
<orbitz>
flux: *shrug* all the ocaml people i've met seem to hate it
<orbitz>
flux: mostly it's people that don't like the O in Ocaml anyways
<heller>
orbitz: right, thanks. I imagined there might have been some nice introduction
<flux>
the o part of ocaml is great!
<orbitz>
heller: ocaml-tutorial is ok, i fin dmyself just going to the manual more often then not thouhg
<flux>
the most unforunate aspect of it is that it's an advanced topic on ocaml
<heller>
orbitz: sure, once you know the language
<orbitz>
heller: i think the manual is great even when you don't really kow it, btu that's me
<heller>
i will read through it
<adrien>
if you ever see OCamlMakefile generate mli files, tell me :P
<adrien>
(since I'm generating the code for .ml files, I'd like to generate the code for .mli files too ;-) )
<heller>
I have a strong C++ background. What are the chances i will like OCaml ;)?
<orbitz>
heller: depends on if you like C++
<orbitz>
if you like C++, there's simply no hope for you :)
<heller>
I do like C++ :P
<adrien>
heh, I know at least one guy here who'll strongly disagree with you ;-)
<heller>
I especially like its template system
<heller>
i was hoping to find something similiar in caml
<orbitz>
boost spirit will cure you of that easy enough
<heller>
nope, it won't
<heller>
i actually know how to use
<heller>
it
<adrien>
lablgtk2 is quite nice actually
<orbitz>
heller: arguably the polymorphism provided by ocaml is just as strong or stronger than templates in C++
<heller>
sounds good
<heller>
what about introspection?
mikemc has joined #ocaml
<adrien>
I found a huge hole in its support however but it's very easy to fix (I need to ask for a branch on the svn)
<heller>
orbitz: maybe it is good for me to get away from all this template meta programming for a while :)
<adrien>
I think you don't have introspection, but I don't know, I really can't say for sure, I've never needed anything like this in ocaml
<orbitz>
heller: It is very likely the things you think you'll find important in ocaml you will not
<heller>
orbitz: righty.
<orbitz>
Mike Fogus did a great talk at CUFP where he put a list of the things they thought they'd usea lot in Scala when they first started usign it then the list they actually used, and the lists were vastly different
<heller>
hehe
<orbitz>
adrien: camlp4 stuff comes to midn for itnrospection (like sexplib)
<heller>
ok, i will just to learn it ;)
<heller>
so you know, i plan to build some kind of language interpreter for ocaml
<tab>
you mean yet another language interpreter ..
<adrien>
yeah, camlp4 will often work for meta-programming and friends, but it's not really at runtime
<heller>
tab: no, it is not like regular languages
<orbitz>
sure, templates aren't at runtime either though
<adrien>
orbitz: hehehe (for the scala thing ;-) )
<heller>
orbitz: exactly
<adrien>
yup
<orbitz>
this might be a dumb questio, but is there an easy way to convert a char list to a string?
<heller>
so, truth be told, i really got to value the C++ template system
<heller>
and its programming facilities
<heller>
i like to use something new
<orbitz>
heller: C++ templates certainly have their strengths, And you can even see languages like Haskell implementing a similar mechanism under the hood for optimization purpsoes
<heller>
gtg, will bug you later ;)
<adrien>
orbitz: list?
<orbitz>
but i think templates in C++ are really a cluster fuck
<orbitz>
adrien: hrm?
<heller>
orbitz: yes, they are too verbose
<flux>
orbitz, unfortunately no. I bet Batteries has one ;-). I've used this inefficient approach: String.concat "" (List.map (String.make 1) ['h';'e';'l';l';'o'])
<adrien>
orbitz: actually, nevermind: Buffer.add_char should do however
<orbitz>
hrm that's a good idea adrien
<adrien>
you could alloc the string (length = List.length l), and do some kind of List.mapi (yeah, it doesn't exist in the standard lib) where you put directly in the right position
<adrien>
s/could/could also/
<adrien>
flux: well, the code is compact ;p
<orbitz>
if i'm using ocamlc -i to geneate an interface and the modules uses a function defined in another module in the same project, do i need the .cmi of that other module already? (I keep gettign unbound module error)
<flux>
adrien, yes, and readable etc as well! ;-)
<flux>
(I think I learned the trick here.)
<adrien>
flux: let len = List.length l in let buf = Buffer.create len in List.map (Buffer.add_char buf) l
<orbitz>
it just is areal simple python script to install latest ocaml + jane st core + dependencies
<adrien>
hmmm, godi?
<adrien>
but godi is sometimes (often...) old
<orbitz>
yeah this is my attempt to stay up to date on the latest stuff i wanted
<orbitz>
and it's designed to install in a self contained location (for me ~/bin/ocaml)
<orbitz>
I find it useful because i don't have privs on my work machiens so i can just use that to install eveyrthing I need
<adrien>
well, for that, godi can be installed anywhere
<orbitz>
maybe i'll add godi in that
<adrien>
but the issue I have with godi is that so things can remain unupdated for a very long time
<orbitz>
i found it was a PITA to install core though, like or sexprlib i needed an older release
<orbitz>
yeah, this is by no means a package manager btw, it's goal is just for me to be able to hit a button and get up a fully functional Ocaml install with all the stuff i like
<adrien>
well, I'm going to move sonn
<orbitz>
it might be useful in ocaml advocation though
<orbitz>
like lisp in a box
<adrien>
agreed, I've often heard that was an issue
<adrien>
bbl
<heller>
hmm, what i find strange is the distinction between * and *. (and friends)
jakedouglas has joined #ocaml
mbac has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
jakedouglas has quit [Read error: Connection reset by peer]
jakedouglas has joined #ocaml
jakedouglas has quit [Quit: Leaving.]
munga has quit [Ping timeout: 276 seconds]
lpereira has joined #ocaml
<orbitz>
heller: most people do at first
<orbitz>
these days i find it endearing
init1 has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
ikaros has joined #ocaml
LionMadeOfLions has quit [Quit: later]
ulfdoz has joined #ocaml
ygrek has joined #ocaml
jakedouglas has joined #ocaml
srcerer has joined #ocaml
srcerer has quit [Client Quit]
wuj has quit [Ping timeout: 265 seconds]
Axsuul has joined #ocaml
bohanlon has quit [Ping timeout: 264 seconds]
iago has joined #ocaml
sepp2k has quit [Remote host closed the connection]
bohanlon has joined #ocaml
ztfw has joined #ocaml
avsm has joined #ocaml
Snark_ has quit [Quit: Ex-Chat]
srcerer has joined #ocaml
srcerer has quit [Read error: Connection reset by peer]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 272 seconds]
ulfdoz_ is now known as ulfdoz
jakedouglas has quit [Quit: Leaving.]
init1 has quit [Quit: Quitte]
ftrvxmtrx has joined #ocaml
ztfw has quit [Remote host closed the connection]
Edward__ has joined #ocaml
BiDOrD has quit [Ping timeout: 272 seconds]
thieusoai has joined #ocaml
<adrien>
oh... ocamlfind can create a .mli automatically
srcerer has joined #ocaml
<hcarty>
adrien: Nifty! How?
<hcarty>
I generally rely on ocamlbuild or OCamlMakefile for more complex modules
<hcarty>
adrien: Thanks for the ocamlbuild pointer
<hcarty>
This should greatly simplify the Batteries-provided myocamlbuild.ml
<hcarty>
Once Batteries moves to 3.12
BiDOrD has joined #ocaml
avsm has quit [Quit: Leaving.]
<adrien>
been using it (mostly) happily for a few weeks now
<hcarty>
adrien: 3.12?
<adrien>
and I don't think I'd be starting to write a myocamlbuild.ml myself if I hadn't removed the ocamlfind support from it first
<adrien>
hcarty: yeah, 3.12
<adrien>
I actually have both versions installed
<gildor>
adrien: can you create a sort of patch for OASIS to use this builtin support ?
ygrek has quit [Ping timeout: 245 seconds]
lpereira has quit [Quit: Leaving.]
<adrien>
gildor: could try :-)
<gildor>
I think you can share most of the code, and I will activate it when OCamlVersion: >= 3.12
<gildor>
adrien: look for (* Add build depends tags *) in src/plugins/ocamlbuild/OCamlbuildPlugin.ml
<gildor>
I think you should just replace ("pkg_"^findlib_pkg) :: acc by sthg else and bypass the inclusion of MyOCamlbuildFindlib.ml
jonafan has quit [Quit: Leaving]
<adrien>
it shouldn't be too hard for "regular" packages hopefully but I think syntax extensions might be a bit different
<gildor>
adrien: we don't handle yet syntax extension
<gildor>
anyway
jonafan has joined #ocaml
<adrien>
gildor: I mean, when syntax extensions being used, not their creation (it's not a big deal anyway)
<gildor>
adrien: yep, I understand, and OASIS don't handle yet usage of syntax extensions
<gildor>
adrien: mainly because I don't figure how to do it cleanly
Smerdyakov has joined #ocaml
bohanlon has quit [Quit: BUH BYE NOW]
<adrien>
gildor: ok, I thought it handled that part, my mistake
<gildor>
adrien: not yet, once it will be clear, I will implement it
<gildor>
(right now I am busy trying to have an effective handling of data from plugins)
<hcarty>
adrien: I have the same (3.11.2 and 3.12.0), and have been enjoying experimenting with 3.12.0's new features.
Smerdyakov has quit [Quit: Leaving]
<adrien>
btw, does oasis handle the following: src/{common,app1,app2}: common has, well, common files for app1 and app2, and app1 and app2 should be built separately (mainly because the have files with the same name)
<adrien>
hmmm, and I think I need some sleep :p
<adrien>
hcarty: haven't had troubles with 3.12 except the camlp4 incompatibilities but now it's solved (I was using mikmatch) so I mostly switched to it
<gildor>
common, app1 and app2 are applications ?
<gildor>
or libraries ?
<adrien>
app1 and app2 are applications and common contains a set of functions/types that is used by both
<gildor>
common is a library ?
<adrien>
yes
<gildor>
it should work except if there are tags that apply to app1 only or app2 only
<gildor>
in this case, you should separate app1 and app2 in two different directory
<adrien>
forgot to mention that I don't link app1 and app2 against the same libraries =/
<gildor>
should work still
<gildor>
but you'll get pkg_XXX when compiling files for app1 but not when linking
<gildor>
this can be a problem if there are name clashes between libraries
<gildor>
but the solution is to have two separate dir
<adrien>
I should try then, currently I'm using some kind of shell script that grew from 2 lines to 80 lines, including very ugly ones (but some lines are definitely to be written in shell script)
<adrien>
(I don't want to link the "server" part against lablgtk...)
<adrien>
well, I got really tired suddenly, good night :-)
<gildor>
night
jakedouglas has joined #ocaml
jonafan has quit [Quit: Leaving]
Edward__ has quit []
_unK has quit [Remote host closed the connection]
ikaros has quit [Quit: Leave the magic to Houdini]