adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml-lang.org | Public logs at http://tunes.org/~nef/logs/ocaml/
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 260 seconds]
ulfdoz_ is now known as ulfdoz
Yoric has quit [Ping timeout: 252 seconds]
wagle_ is now known as wagle
wagle has quit [Ping timeout: 250 seconds]
wagle has joined #ocaml
fusillia has quit [Remote host closed the connection]
madroach has quit [Ping timeout: 244 seconds]
madroach has joined #ocaml
wagle has quit [Remote host closed the connection]
wagle has joined #ocaml
Siphonblast has joined #ocaml
cdidd has joined #ocaml
ontologiae has joined #ocaml
lolcathost has joined #ocaml
hongboz has joined #ocaml
myx has joined #ocaml
lolcathost has quit [Remote host closed the connection]
lolcathost has joined #ocaml
ontologiae has quit [Ping timeout: 264 seconds]
Yoric has joined #ocaml
lolcathost has quit [Read error: Connection reset by peer]
emmanuelux has quit [Ping timeout: 244 seconds]
snarkyboojum_ is now known as snarkyboojum
Yoric has quit [Ping timeout: 252 seconds]
hongboz has quit [Ping timeout: 264 seconds]
emmanuelux has joined #ocaml
mattrepl has quit [Quit: mattrepl]
emmanuelux has quit [Quit: emmanuelux]
emmanuelux has joined #ocaml
m_m has joined #ocaml
Yoric has joined #ocaml
Snark_ has joined #ocaml
emmanuelux has quit [Quit: emmanuelux]
gour has joined #ocaml
jewel has joined #ocaml
adrien_o1w has joined #ocaml
<gour> morning
<gour> adrien: you're working on lablgtk?
adrien_oww has quit [Ping timeout: 245 seconds]
m_m has quit [Read error: Operation timed out]
<adrien> hi
<adrien> yes I am
<gour> i like almost everything i read about ocaml yesterday, but considering we want to write multi-platfrom gui app. i just want to be sure that ocaml/gtk (iow lablgtk) is safe option to count on?
<adrien> definitely safe for that
<gour> adrien: thanks
* gour is happy all interested lists are available via gmane :-)
<gour> does lablgtk support loading glade interfaces?
<adrien> yes
<adrien> not something I've done a lot however
<gour> i see support for libglade, but not sure if it is still supported or deprecated=
<gour> ?
<adrien> I think you can load the .glade files directly or translate them to ocaml
<adrien> well, I don't think it's deprecated in lablgtk but iirc glade is deprecated upstream
<gour> yeah
<adrien> but GtkBuilder is probably only good in GTK+3
<gour> well, we have to get familiar with some basics of ocaml 1st and re-learn some stuff we're familiar with when learning haskell
<gour> gtk3 is not on the radar soon?
<adrien> lablgtk's main difficulty is that it uses objects
* adrien should write a very short high-level intro to lablgtk
<adrien> well, gtk3 is not that easy: it changes a lot of things; there's work on it but I don't think it's very usable
<gour> at least, for the basic wrapper, is there some help from introspection?
<adrien> what do you mean?
<gour> iirc, many language bindings take help from the gtk's introspection capabilities and generate bindings almost automatically
<adrien> ah
<adrien> that's something that's being done for gtk+3 support
<adrien> I don't think it's a good idea however :P
<adrien> at least not using the gobject-introspection tools
<gour> hmm
<adrien> imho they take good data, make it hard to use, and spit it into a binary file or XML
<gour> wxpython also uses new method to automate bindings generation by reading doxygen xml interfaces
<adrien> it's a perfectly valid approach as long as the API of the library has conventions
<adrien> what I'm saying is that the gobject-introspection tools (as in the files you have in /usr/bin) are awful
<gour> i never touched it, just somewhat aware of the principle
<gour> just wonder what is used in e.g. gtkada...
<gour> ..or gtk2hs
<adrien> I it's buggy because it processes the data instead of exposing it directly
<adrien> gtkada; I think ada has been designed to be fairly interoperable with C (dedicated types?) so it should be easy even without annotation support
<adrien> however, without annotations, you lose some type safety
<gour> yeah, losing type-safety is not good in langs like ocaml/haskell
<adrien> or maybe it doesn't but then I'm not sure how it manages to do so
<gour> have you take a look at gtk2hs recently?
<adrien> no, I haven't but I don't think the difficulty for gtk+3 bindings can be automated
<adrien> you need to ditch gdk support (or move it elsewhere), make cairo bindings, make them a dependency of lablgtk2, remove lots of API and add new ones
<adrien> and I wouldn't be surprised there are more such issues lurking
ftrvxmtrx has quit [Quit: Leaving]
<adrien> yeaht, they don't use gobject-introspection
<adrien> but they probably rely on the annotations which are in the C sources
<adrien> which, unfortunately, GTK+ does like crap since these annotations are only in .c files and not .h files, which makes them usually unavailable
<adrien> that's actually a big issue: the same source release of lablgtk should be usable with several versions of GTK+3
<adrien> so you need to #ifdef on the versions and that's not trivial with this shceme
<adrien> scheme*
<gour> uhh
<gour> wxpython (pheonix) project uses same tool as pyqt (SIP)...i know, it's C++, but this is even more complicated, right?
<gour> of course, it's for python
<adrien> well, binding C++ to python is simpler than to ocaml
<adrien> and one difference is that you can have bugs which go unnoticed with bindings to python
<adrien> and that hides gobject-introspection bugs
<adrien> but ocaml is unforgiving (well, not so much ocaml as the linker which complains about undefined references)
<gour> so, not much helpers...what about binding other C libs. nothing like c2hs for ocaml (except SWIG)?
<adrien> there's my "cowboy" tool which can generate nice bindings but it requires work for each class of library (for now there's support for those based on glib)
<adrien> I don't think making bindings is actually something you can also automate if you want a good API
<adrien> and sane code
<adrien> and there are many quirks possible because of C types (how to bind an argument "int*" or "int**"?)
<adrien> I need to leave a bit, buying bread
<gour> ok. ta
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
tane has joined #ocaml
<adrien> back
tane has quit [Quit: Verlassend]
weie_ has joined #ocaml
weie has quit [Ping timeout: 244 seconds]
<gour> adrien: is you cowboy just for gtk and where it is?
<gour> *your
<adrien> forge.ocamlcore.org -> cowboy (or git.ocamlcore.org -> cowboy)
<adrien> it uses yacfe to parse unprocessed C then it simplifies it (for instance it removes the body of functions) and the last layer is a library-specific backend
<gour> let me check it out
<adrien> but this requires some experience with bindings first
<Qrntz> yes, I used that one mostly when binding to SMOKE
<gour> Qrntz: smoke is another (than SIP) approach?
<Qrntz> there was also one specifically for C++ binding in French, not sure I'll be able to find it right now though
<Qrntz> it's an introspection layer
<gour> something like GIR?
<Qrntz> my best motivation is that some bindings for CL and C# are using it, and if they can, why can't OCaml? :-)
<Qrntz> I'll have to look GIR up, never heard of it
<adrien> "gobject-introspection"
<Qrntz> ah
<Qrntz> right
<adrien> it's annoying when you're using git inside a project with "gir" in its name ='(
<adrien> well, iirc the only thing that can change when binding C++ is that you'll have to extern "C" { ... } your code
<Qrntz> I never tried GObject introspection, I'm not much of a GTK type and various people have persuaded me that I'll be better to remain that way
* gour has settled on Fossil dvcs - the best we've found after darcs
<gour> lol
<gour> in any case, OCaml language deserves good GUI bindings, imho
<Qrntz> GIR seems to provide introspection by generating parsable files, right?
<Qrntz> SMOKE has a dynamic runtime you can query
<Qrntz> I think I'll still have to generate some .mli files from data provided by SMOKE to ensure type safety, though
<Qrntz> doesn't seem to be another way
<Qrntz> s/^/there /
Snark_ is now known as Snark
<gour> now i wonder why i did not choose ocaml at first place, but started with haskell and chased away some contributors, then had to postpone project for some years, exploring D, then Ada & co. recently :-/
<gour> by using Ada (Modula-2) or Nimrod we'd have to sacrifice our preference of FP...
mal`` has quit [Remote host closed the connection]
mal`` has joined #ocaml
* gour is reading tutorials...
watermind has quit [Ping timeout: 260 seconds]
Yoric has quit [Ping timeout: 246 seconds]
hcarty has quit [Ping timeout: 246 seconds]
hcarty has joined #ocaml
hcarty has quit [Ping timeout: 260 seconds]
hcarty has joined #ocaml
<orbitz> Ada seems quite nice though
<orbitz> I haven't used it though
<orbitz> But I think it has a lot of the same higher level goals as the ocaml community
<fasta> How do I do native builds with oasis?
<gour> orbitz: yeah, nice language, but with lot of baggage (like C++) and no FP
<adrien> fasta: CompiledObject: best
<fasta> adrien: is there also a command line option for that?
<fasta> adrien: I mean ocaml setup.ml -foo where foo is your answer?
<adrien> dunno
milosn has quit [Quit: Reconnecting]
milosn has joined #ocaml
myx has quit [Quit: ушёл]
eikke has joined #ocaml
micro_ has quit [Quit: leaving]
<adrien> RTT's web toplevel is pretty fun but also pretty slow :P
cdidd has quit [Ping timeout: 244 seconds]
micro_ has joined #ocaml
eikke has quit [Ping timeout: 246 seconds]
mye has joined #ocaml
ikaros has joined #ocaml
Yoric has joined #ocaml
eikke has joined #ocaml
eikke has quit [Ping timeout: 246 seconds]
eikke has joined #ocaml
ontologiae has joined #ocaml
eikke has quit [Read error: Operation timed out]
eikke has joined #ocaml
troydm has joined #ocaml
<troydm> can i have nested types inside type
<troydm> for example
<troydm> type a = float
<troydm> type b = double
<troydm> type c = a | b
<troydm> ?
<Qrntz> only through sum types
<Qrntz> «type c = Float of float | Int of int»
<troydm> oic
mattrepl has joined #ocaml
ikaros_ has joined #ocaml
ikaros has quit [Ping timeout: 245 seconds]
<fasta> I get the following message: The recompilation of ocaml-rdf.0.2 failed in /home/fasta/.opam/4.00.1/build/ocaml-rdf.0.2.
ftrvxmtrx has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
eikke has quit [Ping timeout: 265 seconds]
wmeyer` has joined #ocaml
<wmeyer`> hi
<lorilan> hi
<adrien> morning
cdidd has joined #ocaml
eni has joined #ocaml
emmanuelux has joined #ocaml
<troydm> how do i split string in ocaml ?
<lorilan> Str.split
<troydm> i don't see any split methods in String
<lorilan> using regexp
<troydm> module
<lorilan> module Str
<troydm> oic thx
<lorilan> 'welcome
<troydm> how do i use it?
<troydm> i need to explicitly import that module?
<troydm> like i want to use it using Str.split syntax
<troydm> if i do open Str
<troydm> it will import all functions from that module
<lorilan> if you prefer you can do Str.( my code )
<lorilan> it's like a local open
<lorilan> otherwise you still can use the Str.my_fun syntax
<troydm> how do i use it?
<troydm> i get Str undefined
lorilan has left #ocaml []
lorilan has joined #ocaml
<lorilan> ha ok
<lorilan> you have to link during compilation
<lorilan> -package str with ocamlfind
<lorilan> or str.cmxa or str.cma if you use ocamlc directly
<troydm> #load "str.cma";; <- like that
<Qrntz> yes, that'll work
<fasta> Is there any library to manipulate paths?
<Qrntz> there's the Filename module
<fasta> To get file extensions for example?
<adrien> Filename
<troydm> how do i parse double from string ?
<Qrntz> troydm, float_of_string?
<thizanne> with Scanf ?
<troydm> Qrntz: thx
<fasta> adrien: Filename doesn't contain such a function.
<fasta> adrien: but Jane Street's version does.
<fasta> How do I install ocaml-core?
mattrepl has quit [Quit: mattrepl]
<adrien> if that's the only thing you're after, String.rindex for '.' plus String.sub will be faster
<adrien> and if you're going to do many file manipulations, ocaml-fileutils will prove helpful
<fasta> adrien: I would prefer to be able to use ocaml-core too.
<fasta> Why doesn't opam do a topsort of the dependencies and run everything in parallel?
<troydm> hmm i've added #load "str.cma" to my source file
<troydm> and now omake is not compiling it
<troydm> how should i add that i need str module?
<troydm> i've tried OCAML_LIBS = str adding in OMakefile
<fasta> It's just called 'core' and I had to update.
wmeyer` has quit [Ping timeout: 256 seconds]
<Qrntz> troydm, #load is a toplevel directive, it doesn't work with compiled sources
<Qrntz> I'm not familiar with OMake so I can't exactly tell you how to make it do what you want
<troydm> Qrntz: ic, i've used OCAML_OTHER_LIBS = str
<troydm> and it worked
<Qrntz> alright then
<troydm> also i'm not sure if it's righ way to do that
<fasta> When using core, I get: ocamlfind: Error from package `threads': Missing -thread or -vmthread switch
<fasta> Can libraries change behaviour on what compiler switch was specified?>
<adrien> no
<adrien> different modules might be linked in however
<fasta> I am using oasis, but I have no idea what it wants me to do, however.
<fasta> Is there any oasis based package dependent on core such that I can see how they run it?
<fasta> I want to use Filename, but Core.Filename doesn't exist and neither does Filename?
<fasta> Do I have to do something special to use the core library?
<fasta> They say it's an overlay, which seems to suggest that it replaces the original core library.
pango_ has joined #ocaml
pango has quit [Ping timeout: 244 seconds]
<fasta> I can do open Core.Avltree;;, but I cannot do open Core.Filename;; ...
<adrien> ?
<fasta> adrien: All I want to do is call Filename.split_extension https://ocaml.janestreet.com/ocaml-core/latest/doc/core/Filename.html
<fasta> I already did cd `ocamlfind query core ` to see that core_filename.mli contains the interface.
<eni> how do i write word per word into a file?
<fasta> Running ocaml top-level, was able to open Core.Avltree;;
<eni> (binary writing)
<thizanne> with Pervasives.write_byte
<eni> thanks thizanne
<fasta> Is my question too trivial/too hard/too boring?
<fasta> adrien: ?
<eni> there's output_bute
<eni> byte*
<thizanne> yes, it may not be the actual name
<eni> and not the size I was asking for, but I wonder if it's possible to write a single word into a file.
mattrepl has joined #ocaml
<thizanne> couldn't you write output_word (simply) with output_byte ?
<eni> I'd still have to complete the remaining word though
<Qrntz> eni, there's output_value but if you need strictly a single word, you'll probably have to use output_byte
<fasta> Does output_byte take care of platform differences?
<fasta> If not, why would you ever use a function that doesn't?
<thizanne> which differences are you thinking about ?
<eni> a byte is 8bit everywhere..
<fasta> Never mind :)
<fasta> I solved my own problem, btw.
<fasta> I am going to go with the theory of out of date documentation.
<fasta> If there is a way to list all symbols exported for a given BuildDepends entry, I am all ears.
<fasta> So, hypotetical_command core should return a list of all symbols fully qualified by the module name.
<fasta> (with 100% accuracy)
<fasta> Why is calling an interpreter (Ruby) faster than calling a natively compiled binary to perform an action?
<fasta> Is that because there is no dead code elimination in the native code compiler?
<fasta> I used oasis compilation option 'best'.
<adrien> :q
<adrien> blah
<fasta> adrien: ?
<adrien> wrong window
<fasta> This is the whole Ruby program: print File.extname(ARGV[0]
<fasta> )
<adrien> the interpret might well be smaller
<adrien> and have less things to initialize
<adrien> however, native code stuff loads very quickly
<fasta> I don't get why one compiler cannot just also slim down the code it generates.
<adrien> fasta: and, in a toplevel: module X = SomeModuleYouWantToSeeTheContentsOf;;
<adrien> fasta: it's quite likely there is nothing to slim
<adrien> when you link in a module, it gets initialized at startup
<fasta> adrien: how do you mean? I think it just includes the complete modules.
<adrien> and it evaluates all toplevel expressions
<fasta> adrien: of which 99.9% is not needed.
<adrien> of which 100% is needed
<adrien> if you write the following in a module:
<adrien> let () = print_endline "bouh!"
<adrien> and then link that module into an application, you'll see the "bouh!" line printed
<adrien> someone put it there to be executed at initialization; there must be a good reason
<adrien> if there isn't, baseball bats are here to help
<fasta> adrien: sure, but if there are 1000 definitions that are not called, are those compiled out?
<fasta> It's not like it's very hard to determine whether or not a given symbol ever gets called.
<fasta> (in a conservative way)
<adrien> well, you could write:
<adrien> let foo = print_endline "bouh!"; fun () -> 42
<adrien> but I think the main reason is that it's not ocaml but ld which is doing the linking
<adrien> ocaml probably doesn't know "everything" at once
<fasta> adrien: linking?
<fasta> adrien: linking doesn't happen for native applications, does it?
<adrien> it definitely does
<fasta> adrien: that is, the linking is done after it has been compiled and linked.
<adrien> not for byte ones however but iirc bytecode applications take less space
<fasta> adrien: at run-time there is no linking, or is there?
jewel has quit [Ping timeout: 244 seconds]
<adrien> no, not at runtime but consider what happens with "ocamlopt -verbose a.cmx b.cmx"
<adrien> + as -o '/tmp/camlstartup3dbb62.o' '/tmp/camlstartup94fe99.s'
<adrien> + gcc -o 'a.out' '-L/opt/ocaml/lib/ocaml/std-lib' '/tmp/camlstartup3dbb62.o' '/opt/ocaml/lib/ocaml/std-lib/std_exit.o' 'b.o' 'a.o' '/opt/ocaml/lib/ocaml/std-lib/stdlib.a' '/opt/ocaml/lib/ocaml/std-lib/libasmrun.a' -lm -ldl
<adrien> ocaml creates a smallish asm stub and then calls the linker for all the files it has
emmanuelux has quit [Quit: emmanuelux]
<adrien> it does almost nothing
jewel has joined #ocaml
<adrien> one possibility actually would be that it determines which symbols are not needed and then creates corresponding linking instructions to leave them out
<adrien> that sounds doable but I bet it's definitely not portable
jewel has quit [Ping timeout: 260 seconds]
emmanuelux has joined #ocaml
<fasta> adrien: what's not portable about it?
<fasta> adrien: why does it call gcc and not the actual linker?
<fasta> adrien: oh, never mind.
<adrien> you should always invoke GCC rather than the ld directly because it will set some parameters and is easier to use
<adrien> as for portability, I guess such scripts would be limited to gnu binutils
<fasta> adrien: does ghc also call gcc?
<adrien> I hadn't thought about that before so I'll probably give it a try
<adrien> dunno about ghc
hongboz has joined #ocaml
<troydm> is there a mutable array format in caml suitable for storing large array of 2 dimension double values dat can be randomly modified
<troydm> Buffer seems not suitable for this task
<Qrntz> troydm, look into the Bigarray library
<Qrntz> why would Buffer be? it's string-based
<troydm> Qrntz: can i modify a value in Bigarray randomly?
<Qrntz> arrays are random-access structures by definition
<troydm> ic, thx
<Qrntz> you're welcome
fayden_ has joined #ocaml
fayden_ has quit [Client Quit]
fayden_ has joined #ocaml
<fasta> adrien: I also wrote it in C++, and there the run-time is 0.000 seconds and a compilation time that's also 8 times lower than that of ocaml.
fayden has quit [Ping timeout: 265 seconds]
fayden_ is now known as fayden
<adrien> that might be because you're pulling in a big library (core)
<adrien> but hard for me to say
<fasta> adrien: in C++ I also let another program do the work for me.
<fasta> adrien: er library
<fasta> (and it is probably more portable and just as type-safe as the OCaml version)
<fasta> Conceptually the two are the same, but C++ is better across all axis.
<fasta> Ruby won by development speed on this absolutely trivial test, however.
LeNsTR has joined #ocaml
<troydm> rror: Unbound value Bigarray.float64_elt <- is something wrong?
<troydm> shouldn't it be bounded?
<troydm> i did #load "bigarray.cma" in my interp
<Qrntz> troydm, works for me
<Qrntz> what are you trying to do?
<troydm> Bigarray.float64_elt;; <- in ocaml interp
<troydm> Qrntz: i'm looking through defined types in Bigarray
<Qrntz> it's a type, not a value
<Qrntz> you can do «module Bigarray = Bigarray» to see its contents
<Qrntz> or, if you want to access types you'll have to do it in type context
<Qrntz> such as «type t = Bigarray.float64_elt»
weie_ has quit [Quit: Leaving...]
<troydm> type Image = Bigarray.float64 Bigarray.Array2 <- i want something like this
<troydm> but it seems it's wrong to define it that way
<orbitz> types are lowercase
<troydm> yeah right sorry
<troydm> fixed that but it still isn't compiling
<orbitz> Bigarray.Array2 is not a type
<troydm> so i want to define a array2 of float numbers as image
<troydm> hmm
<Qrntz> that'd be «(float, float64_elt, c_layout) Bigarray.Array2.t» (probably)
<troydm> Qrntz: thx, i've already figured it out
<troydm> type image = (float, Bigarray.float64, Bigarray.c_layout) Bigarray.Array2.t
ontologiae has quit [Ping timeout: 265 seconds]
mattrepl has quit [Quit: mattrepl]
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 252 seconds]
hcarty has quit [Ping timeout: 246 seconds]
hcarty has joined #ocaml
hongboz has quit [Ping timeout: 265 seconds]
Yoric has quit [Ping timeout: 252 seconds]
Snark has quit [Quit: Quitte]
gour has quit [Disconnected by services]
gour_ has joined #ocaml
gour_ is now known as gour
xavierm02 has joined #ocaml
xavierm02 has quit [Quit: Leaving]
xavierm02 has joined #ocaml
<lorilan> is there some ocsigen who can tell me how to implement an output module for the hmtl5.make_printer fonctor of the tyxml library ?
<lorilan> *ocsigen user
<lorilan> ok i'm just tired
<lorilan> i think i got the solution
gour has quit [Quit: WeeChat 0.3.8]
pango_ is now known as pango
xavierm02 has quit [Quit: Leaving]
ulfdoz has quit [Ping timeout: 264 seconds]
Yoric has joined #ocaml
ikaros_ has quit [Quit: Ex-Chat]
Yoric has quit [Ping timeout: 260 seconds]
eikke has joined #ocaml
<lorilan> a fonction give me back a value of type [> `Html ] elmt
<lorilan> but i need a value of type [ `Html ] elmt
<lorilan> what am I missing ?
<companion_cube> I think it's compatible?
<lorilan> i think so
<lorilan> but not ocamlc ...
<companion_cube> the > is a covariance annotation
<companion_cube> err, a subtyping annotation
<lorilan> here is the msg I get
<lorilan> Error: This expression has type [> `Html ] Html5.M.elt but an expression was expected of type Html5.M.doc
<lorilan> and when I look the doc
<lorilan> i see type doc = [ `Html ] elt
<companion_cube> try casting it
<companion_cube> (foo bar : [ `Html ])
<lorilan> ok
<lorilan> what the ??
<lorilan> it compile
<companion_cube> it's because ocaml's type inference is weak w.r.t. subtyping
<lorilan> thx for the tip
mattrepl has joined #ocaml
<companion_cube> no pb :)
eni has quit [Ping timeout: 265 seconds]
ontologiae has joined #ocaml
eni has joined #ocaml
mal`` has quit [Read error: Operation timed out]