smkl changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn, A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/, A free book: http://cristal.inria.fr/~remy/cours/appsem, Mailing List (best ml ever for any computer language): http://caml.inria.fr/bin/wilma/caml-list
demitar_ has joined #ocaml
Demitar has quit [Read error: 54 (Connection reset by peer)]
Nutssh has joined #ocaml
Kinners has joined #ocaml
Kinners has quit [Read error: 104 (Connection reset by peer)]
tomasso has quit [Read error: 60 (Operation timed out)]
tomasso has joined #ocaml
cjohnson has quit ["Drawn beyond the lines of reason"]
cmeme has quit [zelazny.freenode.net irc.freenode.net]
srv has quit [zelazny.freenode.net irc.freenode.net]
mellum has quit [zelazny.freenode.net irc.freenode.net]
Hadaka has quit [zelazny.freenode.net irc.freenode.net]
cmeme has joined #ocaml
Hadaka has joined #ocaml
srv has joined #ocaml
mellum has joined #ocaml
wazze has joined #ocaml
tomasso has quit ["Leaving"]
Swynndla has joined #ocaml
gim_ has joined #ocaml
Nutssh has quit ["Client exiting"]
Nutssh has joined #ocaml
ott has joined #ocaml
Nutssh has quit ["Client exiting"]
ott has quit [Remote closed the connection]
ott has joined #ocaml
blueshoe has joined #ocaml
ejt has left #ocaml []
Swynndla has quit ["Leaving"]
blueshoe has quit [Read error: 54 (Connection reset by peer)]
blueshoe has joined #ocaml
Tachyon76 has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
Tachyon76 has quit ["Leaving"]
cjohnson has joined #ocaml
noss has joined #ocaml
demitar_ is now known as Demitar
cDlm has joined #ocaml
<cDlm> modules behave differently in toplevel than when compiled, I'm confused
<cjohnson> ?
<cDlm> i get "Unbound module Mof" though the same code is ok in toplevel
<cjohnson> do you do a #load or whatever in the toplevel?
<cDlm> i #use "mof.ml";;
<cjohnson> okay
<cjohnson> so, you need to tell the compiler to use mof.ml when you compile the other code, methinks
<cjohnson> i *think* (not 100% sure) #use is just a toplevel directive.. it wouldn't do you any good in another .ml file
<cDlm> yes
<cDlm> i tried open Mof in the other module, does nothing
<cDlm> but i'm using a generic makefile, maybe it does not see some deps
blueshoe has joined #ocaml
<Banana> cDlm: when you compile modules you have to respect dependencies. thus you have to compile mof.ml before modules using it. then you compile your module usemof.ml with : ocamlc mof.cmo usemof.ml
<Banana> (or ocamlopt mof.cmx usemof.ml if you use native compiler).
<cDlm> i do that
<cDlm> seems i need to write a .mli
<cDlm> ah and module This = struct seems to be a toplevel-only construct :(
<Banana> if you don't write it, ocamlc generates a .cmi which exports everithing in your module.
<Banana> cDlm: no they are not.
<Banana> what does your code look like ?
<cDlm> file a.ml : module A = struct foo end
<Banana> hum
<Banana> ok i see your problem.
<cDlm> file b.ml : module B = struct bar using A.stuff end
<Banana> using a separate file *already* declare a module.
<cDlm> i did that so i can test using #use in the toplevel
<Banana> if you use module ... struct inside this module then you have a nested module.
<cDlm> that sucks :p
<Banana> so the module you are refering too is A.A not A
<Banana> cDlm: it does not.
<cDlm> so either I put module... and #use, either I compile, but not both ?
<Banana> toplevel is not meant for developping big applications.
<cDlm> it is not a big app
<Banana> anyway, don't use #directives in files that will be compiled.
<cDlm> i don't
<cDlm> i just want to be able to #use my module source files
<Banana> if you want to test your module then launch : ocaml mof.cmo
<Banana> you will be able to open Mof in your toplevel
<cDlm> this looks like what i want :)
ott has quit [Remote closed the connection]
ott has joined #ocaml
<Banana> be aware that if you have many .cmo you have to pass them in the dependency order : ocaml a.cmo b.cmo c.cmo if c use b which use a for exemple.
ott has quit [Remote closed the connection]
<cDlm> ok that works better
<cDlm> thanks :)
<Banana> nothing.
<cDlm> but i still consider the nested module a bug
<Banana> non its very usefull.
<cDlm> s/bug/misfeature/
<cDlm> i you want nested modules do module a = struct module nested = struct
<cDlm> at least its clearly nested
<Banana> yeah but how do you call something in file toto.ml (without module foo ) inside. it is redundant to have module Foo inside of foo.ml
<cDlm> maybe but it allows #use
<Banana> maybe you are used to toto.java containing class Toto ... ;)
<cDlm> yes
<Banana> further more, it isn't always wise to use open directive.
<cDlm> toto.h containing @interface Toto, precisely
<cDlm> the problem is if you cut n paste code in the toplevel it will lack the module declarations
<Banana> there is another way.
<Banana> you just start : ocaml
tomasso has joined #ocaml
<Banana> then #load "mof.cmo";; instead of #use "mof.ml"
<cDlm> but i have to compile mof before that
<Banana> then you can open Mof or use . notation : let y = Mof.foo x
<Banana> yes.
<Banana> but don't complain. you would have harder time with your .h .cpp .java or whatever ;) having both an interpreter and a (two) compiler is realy handy
<cDlm> bof
<Banana> ben oui.
<Banana> oups.
<cDlm> &&
<cDlm> i liked caml as a study language, now i'm rather skeptical
<Banana> why ?
<cDlm> too constraining, not so readable
<Banana> Ocaml is realy readable (once you code properly).
<Banana> and if by consraining you mean typing "issues" then it's a good thing.
<cDlm> i mean functors and classes and tyoecasts
<cDlm> i'm too used to thinking in objects maybe
<mellum> Sounds pretty vague to me...
<Banana> yes.
<Banana> that might be it cDlm
<Banana> once you get used to functionnal style you'll see.
<cDlm> i was
<Banana> s/used/reused/
<cDlm> mouais
<Banana> functionnal style allows you to write very concise code.
<Banana> and polymorphism allow more code reuse.
<cDlm> perl allows that too
<Banana> allows what ?
<cDlm> concise unreadable code
<cDlm> :)
<Banana> concise code ?
<Banana> erf Ocaml code is readable. Perl code is concise because you can write without blank.
<Banana> + Ocaml is efficient.
<Banana> </troll>
<cDlm> how do you define different records with same attribute names ?
<Banana> you can't within the same module.
<Banana> if so the type checker could not infer types properly (i think).
<cDlm> and what if 2 types should have a "name" attribute ?
<Banana> then name it type t = { tname : string ... } type q = { qname : ... }
<cDlm> berk
<cDlm> my types have long names
<cDlm> well nevermind
<Banana> type inferrence is worth it (IMHO)
Banana is now known as Banana[AFK]
<Demitar> It's a lot less of a hassle in real code than what it sounds like. Mostly because records are commonly an abstract type inside a module.
Demitar has quit ["Bubbles..."]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
cjohnson has quit ["Drawn beyond the lines of reason"]
mattam_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
yella has quit [Read error: 110 (Connection timed out)]
mimosa has joined #ocaml
blueshoe has joined #ocaml
noss has quit ["hej då"]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
tomasso has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
blueshoe has joined #ocaml
mattam_ is now known as mattam
wazze has quit ["Learning about how the end letters on French words are just becoming more and more silent, I conclude that one day the French]
Banana[AFK] is now known as Banana
tomasso has joined #ocaml
blueshoe has quit [Read error: 54 (Connection reset by peer)]
tomasso has quit [Read error: 104 (Connection reset by peer)]
tomasso has joined #ocaml
Nutssh has joined #ocaml
Swynn_wk has joined #ocaml
blueshoe has joined #ocaml
blueshoe has quit [Read error: 54 (Connection reset by peer)]
Nutssh has quit ["Client exiting"]
gim_ has quit ["pouic"]
blueshoe has joined #ocaml
mimosa has quit ["J'ai fini"]
unxn has joined #ocaml