kaustuv changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
julm has quit [Read error: 60 (Operation timed out)]
julm has joined #ocaml
zaemis has joined #ocaml
Lomono has quit ["Don't even think about saying Candlejack or else you wi"]
sporkmonger has quit []
Lomono has joined #ocaml
sporkmonger has joined #ocaml
<zaemis> hello, all :)
ched_ has quit [Read error: 110 (Connection timed out)]
ched_ has joined #ocaml
Associat0r has joined #ocaml
<komar_> Hello again. Yet another question about camlp4.
<komar_> How I can get value of x, cached, for example, with x = SELF?
<komar_> I only able to get a string (which is name of value) or Ast.expr = Syntax.Ast.expr
<julm> komar_: what do you mean by "cached"?
<komar_> *catched :)
<julm> you mean "caught"?
<komar_> yes
<julm> could you give an example of the source you're using camlp4 on, and tell more on what you exactly want to have from the name of the value
<julm> tell us*
<julm> komar_: are you still there?
<julm> ok
<komar_> Something like this
<julm> komar_: I don't think that what you want is possible; camlp4 is a preprocessor: it acts before the code is actually run. what you possibly may have is an Ast of {Some "string"} but not the value {Some "string"}
<julm> -possibly
<julm> that said I don't know if you could access the Ast of {Some "string"} when you encounter {a} without building yourself a table of bindings..
<komar_> julm, ok. Thank you for help.
<julm> np ;)
<komar_> I'll find another way.
zaemis has quit ["Trillian (http://www.ceruleanstudios.com"]
sporkmonger has quit ["Poof!"]
Snark has joined #ocaml
ikaros has joined #ocaml
Maddas has quit [Remote closed the connection]
Submarine has joined #ocaml
jmou has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
ikaros has quit ["Leave the magic to Houdini"]
ertai has quit ["leaving"]
schme has joined #ocaml
jmou is now known as julm
mbishop_ has joined #ocaml
mbishop has quit [Read error: 113 (No route to host)]
Submarine_ has joined #ocaml
Submarine has quit [Remote closed the connection]
mishok13 has joined #ocaml
rwmjones has joined #ocaml
dileep has joined #ocaml
<dileep> is it possible to to do a Unix.select on socket file_descr ?
Yoric[DT] has joined #ocaml
LeCamarade|Away is now known as LeCamarade
jeanbon has joined #ocaml
<flux> dileep, yes
munga has quit [Remote closed the connection]
hkBst has joined #ocaml
Ched has joined #ocaml
ched_ has quit [Read error: 101 (Network is unreachable)]
rjack has joined #ocaml
<det> dileep, (wont work on Windows)
Lomono has quit ["Don't even think about saying Candlejack or else you wi"]
Submarine_ has quit [Client Quit]
dileep has quit ["Leaving"]
rjack has quit ["leaving"]
<flux> I wonder if the destructive enumerations of Batteries can be as surprising as they have been in python: http://sandersn.com/blog/index.php?title=python_s_iterators_are_a_bad_implementat&more=1&c=1&tb=1&pb=1
<flux> a function that would 'magically' make a copy of a stream non-destructively could be nice
<flux> fortunately batteries (iirc) comes with a non-desctructive variant too, but I suppose it is a bit more cumbersome to use that
<flux> I suppose the problem isn't really the same, as containers look the same as enumerations
<flux> in ocaml, nothing looks the same as something else :)
<flux> oh, apparently python doesn't have such a magical function, it was false information :)
youscef has joined #ocaml
schme has quit [Remote closed the connection]
rwmjones has quit [Read error: 113 (No route to host)]
schme has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
rwmjones has joined #ocaml
schme has quit [Read error: 113 (No route to host)]
_andre has joined #ocaml
_andre has quit ["leaving"]
_andre has joined #ocaml
Ched has quit [Read error: 113 (No route to host)]
Ched has joined #ocaml
ulfdoz has joined #ocaml
ikaros has joined #ocaml
<deavid> what is the difference between ocamlc and ocamlopt commands? Is ocamlc calling ocamlopt to compile? are ocamlc executables slower that ocamlopt?
<thelema> ocamlc compiles to bytecode
<flux> and ocamlopt native binaries
<thelema> ocamlopt compiles to native code
<flux> thelema took my thunder about the byte code, so I needed to fill in the native code answer :P
<thelema> yes, bytecode is usually slower
<thelema> :P
<flux> ;)
bombshelter13_ has joined #ocaml
<kaustuv> is there any instance where bytcode is faster?
<flux> well, native code cannot use green threads
<flux> so perhaps very thread heavy code can be faster in byte code?
<thelema> probably, but it'd be pretty contrived
<deavid> and I suposse that, it's possible to compile anything into native code; I tried to compile one example that is using graphics library, but it gave me a error, complaining about the library (it seems that it recieves diferent arguments than ocamlc)
<kaustuv> what is the exact command you used and error message from ocamlc/ocamlopt?
<deavid> ocamlc graphics.cma grtest1.ml -o grtest1
<deavid> this works
<deavid> ocamlopt graphics.cma grtest1.ml -o grtest1
<deavid> /usr/bin/ocamlopt: don't know what to do with graphics.cma.
<C_Tux> you need to pass 'graphics.cmxa' as argument, not the cmXa
<kaustuv> use graphics.cmxa
<deavid> wow
<deavid> :P
<deavid> 210Kb of native code; 42Kb of bytecode
<deavid> i suposse that bytecode is smaller because needs an interpreter of bytecode, and so on
<deavid> and native code will be statically linked or dynamic?
<kaustuv> The .cmxas are statically linked, but they can depend on dynamic .sos
<kaustuv> You can find out by running ldd grtest1
<deavid> seems to be static
willb has joined #ocaml
<deavid> there are a couple of .so , but they seem to belong to my OS
Narrenschiff has joined #ocaml
itewsh has joined #ocaml
<julm> deavid: does it change something if you pass -cclib -Wl,-static to ocamlopt?
<deavid> unknown option "static"
<deavid> compiled without static, it gives exactly the same executable
<kaustuv> On my machine, linking with graphics.cmxa adds a dynamic dependency on libX11.so.
<julm> -cclib -Wl,-Bstatic perhaps
<deavid> julm: I was tryinh "-Wl -static" i didn't see that comma
<julm> ah :)
<deavid> warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
<julm> indeed
<deavid> the command was: camlopt -cclib -Wl,-static graphics.cmxa grtest1.ml-o grtest1b
<julm> and does it create grtest1b ?
<deavid> /usr/bin/ld: cannot find -lgcc_s
<deavid> no
<deavid> error during linking
<kaustuv> Here's the payload of just the ocaml code in graphics.cmxa:
<kaustuv> % cat foo.ml
<kaustuv> module G = Graphics
<kaustuv> % ocamlopt graphics.cmxa foo.ml -o foo && strip foo && ls -sh foo
<kaustuv> 156K foo
<deavid> ah, yes there was a dynamic link to X11 :-)
<deavid> with strip, 152Kb grtest1
<julm> deavid: what does : ocamlopt -ccopt -static graphics.cmxa grtest1.ml -o grtest1b
<deavid> fails .. .
<deavid> there are a lot of undefined references when trying to link .a files
jeanbon has quit [".)(.)(."]
<deavid> i should place the log in a paste bin, is long
<julm> same on my Debian..
<kaustuv> For me, this works:
<kaustuv> ocamlopt -verbose -cclib -static -cclib -lxcb -cclib -lXdmcp -cclib -lXau -cclib -lpthread graphics.cmxa -o foo
<kaustuv> 1.7M
jeanbon has joined #ocaml
<deavid> yeah, for me too, but it throws warnings
<julm> warnings for me too
<deavid> warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
<julm> but I have an executable
<deavid> that isn't good :P
<deavid> ok, but probably that executable doesn't work in other systems... so you have lost the "cool thing" in static compilations
<kaustuv> static linking is nearly always a stupid idea
<deavid> probably :-)
<julm> it sure is..
<deavid> but a lot of windows programmers complaining about dll usually say that statically linked programs are better :D
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
<deavid> i have seen several "portable programs" and they usually are dynamically linked, but they come with the needed dll
<kaustuv> I really doubt that's true, but even if it were, one shouldn't be looking to Windows for good taste.
<flux> there was a related trick about that recently
<flux> something about linking with -R\$origin
<C_Tux> rpath ;)
<flux> hmph, to my defence it's -R on solaris, but I doubt the $origin-trick works there :)
<kaustuv> it's an undocumented hack and I hope the next version of gnu ld delibrately breaks $origin to make people come to their senses
<flux> kaustuv, too useful?
<flux> kaustuv, wrapper scripts with $LD_LIBRARY_PATH-magic are nicer?
itewsh has quit [Read error: 60 (Operation timed out)]
<kaustuv> I don't know about nicer, but it is documented and portable.
itewsh has joined #ocaml
<flux> hmm.. so one should a) provide a patch to gnu-people about documentation and b) provide a patch to opensolaris-people bringing in the support ;)
<kaustuv> Why do you want shared libraries to reside in atypical locations?
<flux> I personally don't, but I can see how nice it can be
<flux> for example firefox comes with a set of libraries
<flux> ..and a wrapper script..
<flux> and many commercial vendors do that
<flux> possibly I'd like to distribute Goba with the dependency libraries too, so the binary would run in more platforms as-is ;)
<deavid> kaustuv: because you can run the executable in-place; without having to control where is each library to know how to remove it; Thi is a issue that package managers like dpkg have resolved, but think about it when you want to test some app that isn't packaged
<deavid> I find useful that, because you can try the app, and later, overwrite the libraries and executables by newer ones (from a newer compilation, for example), when you don't want that app, simply delete the folder
mpwd has joined #ocaml
<kaustuv> I do it all the time with GNU stow and have yet to run into a single corner case.
<kaustuv> I take that back. GODI doesn't play well with Stow. But it's the only exception I know of.
rjack has joined #ocaml
<deavid> some apps can use only their own versions of well known libraries, this is a ugly hack, but anyway, for these apps I prefer to have the libs with it, and not install them system wide
shazam has joined #ocaml
<shazam> hello, I've been using <:expr< `$uid:foo$ >> for my variant labels
shazam is now known as palomer
<palomer> however, this is wrong (since labels can be lids too)
<flux> kaustuv, hm, I've used it with stow.. what's the issue I should watch out for?
<kaustuv> flux: I seem to recall that GODI really hates it when other programs try to install libraries to its path
<kaustuv> flux: I have blissfully forgotten the details after I decided to ditch GODI for good
<hcarty> kaustuv: What are you using in place of GODI?
<kaustuv> hcarty: Debian's packages.
<hcarty> kaustuv: Ah, of course :-)
kaustuv is now known as kaustuv_
ertai has joined #ocaml
<palomer> how do you define a pattern for a polymorphic variant? something like <:patt< `$x$ >> (which doesn't work)
<hcarty> palomer: The pa-do code may serve as a reference. It has some support for overloading polymorphic variants.
<hcarty> palomer: It looks like they use <:expr:
<hcarty> palomer: It looks like they use <:expr< `$s$ >>
<hcarty> Sorry... sent that out too soon.
<hcarty> palomer: src/delimited_overloading.ml in the pa-do sources
ulfdoz has quit ["deprecated"]
<palomer> ahh, righto
<palomer> ahh,righto, it _does_ work
<palomer> neverimind
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
komar__ has joined #ocaml
komar_ has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
jado has joined #ocaml
<jado> hi, i've tried the same command than the one to compile with the num library for compiling with Pcre but that does not work : http://paste.ubuntu.com/207010/
<jado> does someone have an idea ?
<hcarty> jado: Add "-linkpkg" to the command
<jado> thanks
<hcarty> jado: On newer versions of OCaml (3.11 and later, I think), you will get warnings and/or errors about using 81.ml as a file name.
<jado> why does it need a letter ?
<jado> prefer*
<hcarty> Because 81 is not a valid module name.
<jado> so it will also give warnings when there is no majuscule in the first letter ?
<hcarty> The compiler used to accept most file names. But the file name defines the module name, so 81.ml would map to the module 81, which is not valid.
<Smerdyakov> jado, what is a majuscule?
<Smerdyakov> jado, and please remember that question marks are not preceded by spaces in English.
<jado> Smerdyakov: sorry
<palomer> majuscule = capitalized in french
<hcarty> jado: No, it's not a direct mapping
<hcarty> For example, foo.ml would map to the module Foo. myLib.ml would map to MyLib.
<hcarty> palomer: Thanks for the clarification.
<jado> ok i see
rjack has quit ["leaving"]
<jado> thanks
<C_Tux> Smerdyakov: hmm what ? :)
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
<deavid> there's any function that emulates the ocaml console? for example, say that function is named "out". I want to write "out myfunc" and get something like "myfunc : a' -> a'" in the console
<deavid> like something to debug
<deavid> im very new to ocaml and this will be helpful to start checking what is doing ocaml
<hcarty> deavid: You can run "ocaml -i foo.ml" and it will display the inferred types for each value in foo.ml.
tautrimas has joined #ocaml
julm has quit [Read error: 60 (Operation timed out)]
tautrimas has quit [Client Quit]
tautrimas has joined #ocaml
youscef has left #ocaml []
<tautrimas> Hello! I'm programming in OCaml for a month or so and I would like to do a networking project. Now the question: is it beneficial to use ocamlnet from the beggining or just go for plain sockets? I've never done anything with networking before
<palomer> a lot of people are exploring ocaml this summer
tautrimas has quit [Read error: 104 (Connection reset by peer)]
tautrimas has joined #ocaml
<tautrimas> I'm very sorry, but my computer has crashed and if somebody replied, please reply
<C_Tux> tautrimas: ocamlnet's api is higer-level and is probably a better choice for bigger projects
<C_Tux> what are you planning to do ?
<tautrimas> try to develop a small distributed computing network
jado has quit [Read error: 104 (Connection reset by peer)]
<tautrimas> well, if ocamlnet is a big thing, then I'll just stick with plain sockets. Thanks!
<C_Tux> well, I guess there is no compelling reason for ocamlnet if you have control over all the computers
<tautrimas> yes yes
<hcarty> tautrimas: You might want to take a look at jocaml.
<tautrimas> some time I already did
<tautrimas> I just might want to drop an eye again
<hcarty> There are also MPI and ocamlp3l.
<tautrimas> for threading model I will try to program something like actors and will see if it works. Thank you for advice
Narrenschiff has quit []
zaemis has joined #ocaml
LeCamarade is now known as LeCamarade|Away
kig has joined #ocaml
jeanbon has quit [".)(.)(."]
ulfdoz has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
tautrimas has quit [Remote closed the connection]
mgodshal1 has joined #ocaml
rwmjones is now known as rwmjones_afk
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
gareth_ has joined #ocaml
<gareth_> hi, are there standard libraries for unconnected, non-blocking udp in ocaml?
mgodshall has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit ["Ex-Chat"]
pants2 has joined #ocaml
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
<deavid> hcarty: /usr/bin/ocaml: unknown option `-i'.
bombshelter13_ is now known as bombshelter13_lu
bombshelter13_lu is now known as bombshelter13afk
<deavid> oh, is ocamlc :-D
pants1 has quit [Read error: 113 (No route to host)]
<deavid> there's a way to load a program into the interpreter but without executing the code? for example, in haskell I could load files into ghci,
<mfp> deavid: the code (let () = ...) will always be executed, as there might be side effects
<mrvn> fun () -> ....
<mfp> deavid: if you have no "toplevel phrases", though, #load "whatever.cmo" and ocaml whatever.cmo will both work
<mrvn> Only thing you get out of it then though is that it syntax/type checks the code.
<deavid> ah, ok, this is what i wanted :-D
<_andre> #use "foo.ml";; works too i think
<deavid> if i have toplevel phrases, they are executed, which is what i want
<deavid> _andre: unbound value use :P
<mfp> deavid: # #use "foo.ml"
<_andre> deavid: did you type the # ?
<deavid> haha
<mfp> ;;
<deavid> ok, it worked
<_andre> :)
<mfp> if you have findlib, you probably want #use "findlib";; too (can be put in ~/.ocamlinit)
<deavid> what is findlib?
itewsh has quit [Read error: 60 (Operation timed out)]
<mfp> findlib/ocamlfind is a lib/tool to manage OCaml libs and ease compilation
itewsh has joined #ocaml
<mfp> it allows to link against libs easily, e.g. ocamlfind ocamlopt -package extlib,uuidm,sqlite3 myprog.ml -o myprog -linkpkg
<mfp> ocamlfind calls ocamlopt with the appropriate -I flags and links against the required .cmxa libs
<mfp> you can also use it in the toplevel to load libs, by doing #require "package";;
<deavid> ah, maybe later i'll try that;
<deavid> There are examples of use of ocaml with sqllite3?
<deavid> or with database registers...
<deavid> I'm installing several packages related (mysql, postgresql, sqllite3 dependencies for ocaml) , but I don't know where i should search for the documentation
<mfp> deavid: on Debian, you can find the HTML API docs on /usr/share/doc/libxxxx-ocaml-dev/html
<mfp> normally the .mli are just as readable (and available everywhere)
<deavid> mfp: thanks :-)
<mfp> around /usr/lib/ocaml/3.11.0/
<mfp> deavid: this might interest you Sqlite http://wiki.github.com/avsm/ocaml-orm-sqlite
<deavid> mfp: interesting; there are equivalents for postgresql '
<deavid> ?
<Smerdyakov> ORM = suck
<mfp> deavid: no ORM AFAIK for PostgreSQL; there's http://merjis.com/developers/pgocaml, but it still requires SQL code (gives many static guarantees, though)
<deavid> ok :-)
<maxote> what about firebird?
<Smerdyakov> deavid, what application are you working on?
<deavid> Smerdyakov: none yet, I'm exploring the possibilities of the functional paradigm for database-oriented programs
<Smerdyakov> deavid, see mine: http://www.impredicative.com/ur/
<deavid> that's for web ...
<deavid> seems to be an ad-hoc solution
<Smerdyakov> What makes it "ad-hoc"?
<Smerdyakov> It's a domain-specific language.
<Smerdyakov> And the SQL approach is independent of anything webby.
<deavid> seems to be a language oriented for web , like php is
<Smerdyakov> See my last line.
<deavid> ok, i was on demos, and there aren't any of these, I'll take a look to the doc
<Smerdyakov> Aren't any of whats?
<Smerdyakov> I'm not claiming the current compiler is able to produce anything but web applications.
<Smerdyakov> I'm talking about the language/library design ideas.
<Smerdyakov> The SQL approach demonstrated there is IMO better than ORMs.
gareth_ has left #ocaml []
<deavid> I can't consider that because I'm still learning about ORMs; The documentation related to Ur SQL seems very complex to understand
<Smerdyakov> Yes, it's only for people who are comfortable with fancy type systems.
<deavid> why do you think that mapping relational data to data objects sucks ?
<Smerdyakov> Because working directly with SQL leads to simpler code.
<deavid> but less automated
<deavid> and that's why ORM are useful
<flux> I think working with relations that would generate SQL would be the optimum
<flux> it would handle the edge cases of different SQL syntax in backends, it would provide static (well, atleast some) guarantees, it would allow safely constructing queries from user input
komar__ has quit [Read error: 113 (No route to host)]
<deavid> for me at least, it's not only a mater of generating SQL. It's a matter of describing the data like objects, where there are a layer that enforces how the data should be acceses and modified
<flux> the last part is where pgocaml doesn't quite work, but otherwise it's pretty nice (well, it's option-type detection also sometimes triggers too eagerly)
<flux> (uh, s/it's/its/2)
<flux> deavid, the thing is that objects are best put into an object database. when all you have is objects, it becomes quite difficult to create performant queries with those interfaces.
<deavid> ok, but which databases are object databases?
<flux> dunno, there's a bunch; i've never used them :)
<deavid> today I've read twice that, and I never knew about something like that
<Smerdyakov> deavid, SQL programming in Ur/Web is more automated than traditional ORM programming.
<Smerdyakov> In fact, traditional ORM can be implemented as a library entirely within Ur/Web, with static types guaranteeing that it's done right.
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
<palomer> what's an ORM?
<palomer> oh, I see
<palomer> you can embed SQL into Ur/Web in a type safe way?
<palomer> what's the type system?
rwmjones_afk has quit [Remote closed the connection]
<Smerdyakov> It's a new type system.
<Smerdyakov> "The Ur type system"
<Smerdyakov> Bird's-eye view is F omega plus type-level records with map.
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
Snark has quit ["Ex-Chat"]
lde has joined #ocaml
bombshelter13afk is now known as bombshelter13_
jeanbon has joined #ocaml
<palomer> type-level records!
<palomer> yeah, you can get SQL with that
<palomer> is there something like "self" for records?
<flux> for ocaml records you mean? no.
<palomer> I'm doing {foo with bar = baz} where baz is an expression which contains instance variables of foo
<palomer> let _ = { aaa = 8; bee = ignore aaa}; <--actually, this is a simpler example of what im trying to do
<flux> ah, ok. well, you need to bind them to some other names prior constructing the record, then
<flux> let _ = let aaa = 8 in { aaa = aaa; bee = ignore aaa }
<palomer> type meow = {mutable aaa:int ; bee : unit -> unit }
<flux> (maybe a shortcut similar to labeled arguments could be written in camlp4 ;-))
<palomer> how would I do it with type meow?
<flux> aaa isn't that different, really, the same thing works?
<palomer> well, I want bee to do something different depending on a
<flux> perhaps you can still find a better example then :)
<palomer> let _ = { aaa = 8 ; bee = print_endline aaa}
<palomer> err, make that
<palomer> let foo = {aaa = 8 ; bee = fun _ -> print_endline aaa}
<palomer> foo.aaa <- 9; foo.bee ()
<flux> you can use lazy evaluation
<flux> let foo = let f = lazy { aaa = 8; bee = fun _ -> print_endline (Lazy.force foo).aaa } in Lazy.force f
itewsh has quit [Read error: 110 (Connection timed out)]
<flux> darn, doesn't work
<flux> perhaps you need to use references then
<flux> ah, never mind
itewsh has joined #ocaml
<palomer> I was porting all my code from objects to records
<palomer> better stick to objects I guess
<flux> you just need to add 'rec' to 'f' and refer to that lazy value (obviously)
<flux> palomer, why would you port?
<palomer> speed, and I thought that it would be straightforward
<palomer> seems it isn't
<palomer> oh, and to make it easier for users to use my library
<palomer> (records are easier to understand)
<flux> records with higher order functions are easier to understand than objects?
<flux> do you need to reveal those records at all to the user?
<palomer> the user can write out values of the type
_andre has quit ["leaving"]
<hcarty> palomer: Why are you including the function in the record?
<hcarty> You could make bee a function which takes a meow value and does the appropriate thing with it.
<palomer> well, in my real code im doing something like let base_implementation = {mutable id : int ; ....}
itewsh has quit [Connection timed out]
<hcarty> module F = struct let bee x = print_endline x.aaa end F.bee some_meow
<palomer> then let derived implementation = { (base_implementation ()) with bar : print_endline id } <--this is my endgoal
<palomer> inheritance is probably the easiest way to do it
itewsh has joined #ocaml
<hcarty> You could do "module F_derived = struct include Foo let bee x = new_bee_here end"
<hcarty> A module probably makes a better replacement for a something like you are talking about, rather than a record on its own.
<hcarty> It may be faster using modules as well, though I'm not certain of that.
<palomer> oh, I see what you're saying
* palomer will ponder this way
<hcarty> palomer: Jason Hickey's book covers this topic very nicely.
<hcarty> Chapter 12
zaemis has quit [Read error: 104 (Connection reset by peer)]
schme has joined #ocaml
Jedai has quit [Read error: 113 (No route to host)]
Lomono has joined #ocaml
Lomono has quit [Remote closed the connection]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
charlenopires has joined #ocaml
Submarine has joined #ocaml
bombshelter13_ has quit []
komar__ has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
beanjon has joined #ocaml
jeanbon has quit [Nick collision from services.]
beanjon is now known as jeanbon
jeanbon has quit [".)(.)(."]
willb has quit [Read error: 110 (Connection timed out)]
eaburns has joined #ocaml
eaburns has quit [Client Quit]
eaburns has joined #ocaml
Submarine has quit [Client Quit]
lde has quit [Read error: 110 (Connection timed out)]
charlenopires has quit [Read error: 104 (Connection reset by peer)]
<jonafan> ocaml's objects seem cool, but on closer inspection, they don't work
<schme> they don't?
<jonafan> nope
<schme> too bad.
<jonafan> yeah...
<jonafan> basically
<jonafan> if you have objects a and b, ocaml needs to be able to figure out how to create [a; b]
<jonafan> if there is any overlap in their interface, i think it should be able to figure that out at compile time
<eaburns> /quit
eaburns has quit ["leaving"]
eaburns has joined #ocaml
<jonafan> you can do [`A a; `B b] though
<hcarty> jonafan: I think you can force that
<hcarty> "[(foo :> base_class); (bar :> base_class]" will give "base_class list = [<obj>; <obj>]"
<jonafan> oh .. i see
<jonafan> i'm used to casting going the other way
<jonafan> okay, i guess objects work
<jonafan> wow, it can go the other way
<jonafan> (if you make a typo, that is)
<jonafan> i take it back
lde has joined #ocaml
lde has quit [Client Quit]
lde has joined #ocaml
schme has quit [Read error: 60 (Operation timed out)]
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
<jonafan> what happens if you need to cast up?
ulfdoz has quit [Read error: 60 (Operation timed out)]
<mfp> jonafan: coerce to a derived class? you cannot do that, but you could as a method to the base class like method as_derived : derived option, returning Some obj if the coercion is possible, or None otherwise
<mfp> s/as a method/add a method/
ulfdoz has joined #ocaml