debona|r has quit [Read error: 104 (Connection reset by peer)]
<dan2>
adhoc polymorphism doesn't let you add extra arguments iirc
<gzl>
just look at the article, it's all pretty clearly laid out
<dan2>
how do I parse options in ocaml
<dan2>
like command line arguments even
bk_ has joined #ocaml
<Nutssh>
Adhoc polymorphism is dynamic dispatch based on runtime type. Ocaml does have htat in the OO system, but natively. Ocaml also doesn't have operator overloading (it maeks type inference a lot more difficult)
<Nutssh>
dan2; $$ Sys.argv: string array $$ containing the command line arguments.
<gzl>
dan2: it's in chapter 8 of that book
<dan2>
gzl: gracias
<Nutssh>
lambdawar, overloading is compile-time dispatch based on the declared types.
<dan2>
ocaml is amazingly simple :)
<lambdawar>
Nutssh, ok, so the difference is the moment of evaluation right ?
<dan2>
its like a combo of python and C almost
<dan2>
:)
<Nutssh>
lambdawar, I'm not sure what you're asking.
<lambdawar>
Nutssh, difference between adhoc poly. and parametric poly.
<Nutssh>
Parametric polymorphism is like C++ templates. Adhoc is dynamic dispatch based on runtime type.
<dan2>
ok
<dan2>
thanks for the clarification, I wanted both tho
<dan2>
:)
<gzl>
it's explained in the link as well, heh
<dan2>
Nutssh: the automatic type changing in C++ is an example of Adhoc
<Nutssh>
You mean int->float autoconversion? Thats resolution, its at compile time. There's also the resolution by use of casts and non-explicit constructors for arguments.
<dan2>
ahh
<dan2>
Nutssh: thats what I am looking for
<Nutssh>
ocaml doesn't have that, having it would make type inference hellish.
<dan2>
;)
<dan2>
Nutssh: c++ has hell with that too :0
<Nutssh>
And type inference is *nice*... I hate java BlahClassWithALongName someVariable = new BlahClassWIthALongName(12);
<dan2>
muhahahhaha
<dan2>
insertFileToString
<dan2>
:)
<Nutssh>
With ocaml, its just type inference and thats it. Three cheers. :)
<gzl>
someone told me that it's worth explicitly writing the types of arguments in function declarations (e.g. let foo (n:int) (m:int) : int = n + m) ... is this reasonable?
<Riastradh>
No.
<Riastradh>
You should put all type declarations in interface files.
<Nutssh>
dan2, thats why I tend to use 'explicit' in C++ constructors when I don't want automatic conversion/instantiation.
<dan2>
right
<dan2>
Nutssh: where can I find some examples of ocaml interfacing with C
<Riastradh>
But I'm going to bed now.
<gzl>
ok
<gzl>
thanks
<Nutssh>
Well, one change. Sometimes you may want to put type declarations in the implementation if you have a cryptic type error. Also, I had to do it for a function that had an argument that was an object that declared a method that had optional arguments.
<gzl>
yeah, this person's claim was that it helps the system provide better error messages or something
<Nutssh>
dan2, see the ocaml reference. There's also several libraries you can get the source to.
<dan2>
ok
<gzl>
i haven't really encountered interface files yet (only just started), so i'll just keep it in mind for when i do, i suppose
<dan2>
is ocaml a garbage collected language?
<Nutssh>
gzl, as a rule, I don't do that unless I'm trying to debug some strange type inference problem. It can make your code more fragile and harder if you change it.
<Nutssh>
dan2, yes.
<dan2>
sweet
<gzl>
ok
<Nutssh>
Err, and also it can make it more fragile because you can change implementation changing the type, but the functionality and semantics are unchanged. Just let inference infer the new type. Now between modules, thats what interfaces are for, and you have to declare them anyways.
dan2 has quit [Remote closed the connection]
CosmicRay has joined #ocaml
CosmicRay has quit [No route to host]
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
yauz_ is now known as yauz
riffraff has joined #ocaml
<riffraff>
hi
<riffraff>
I have the feeling that OCaml's type system finds more bugs at compile time than java and yet allows the programmer to be more expressive. Someone has a link to some document that can confirm my impression?
<Nutssh>
I confirm it. Don't have a document though.. Google for 'ocaml comparison'?
<Banana>
riffraff: ocaml is a statically typed language so any type error is found at compile type. after compilation, type informations are discarded.
<riffraff>
thanks banana, nutssh. Well, I think I understand the differences, somewhat, I was more looking for something like "see, java does not catch this"
smimou has joined #ocaml
smimou has quit ["?"]
<greenrd>
Java currently does not have support for saying "List of x" however this is fixed in the upcoming 1.5 version (with generic types)
smimou has joined #ocaml
<riffraff>
yes. I think the places where java still needs cast are the various factory methods like those found in JNDI. in those places they need to use instanceof, but I can't think of ocaml's equivalent
<greenrd>
heh, I would say that's a weakness of ocaml ;)
maihem has joined #ocaml
Herrchen_ is now known as Herrchen
Nutssh has quit ["Client exiting"]
riffraff has quit ["foo"]
vezenchio has quit ["Join the fight against drunken calculus: Don't drink and derive!"]
samx has joined #ocaml
<samx>
morning
vegai has left #ocaml []
CosmicRay has joined #ocaml
cjohnson has joined #ocaml
GreyLensman has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
gilbertbsd has joined #ocaml
ne1 has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
<samx>
anyone have specifics on what can be done with the new object model? when creating a new classless object, can you inherit from an existing classless object? (that is, can you do something like prototype based inheritance?)
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
ionOS has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
CosmicRay has quit [Excess Flood]
CosmicRay has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
samx has quit ["Leaving"]
CosmicRay has quit [Read error: 60 (Operation timed out)]
Snark has quit ["Parti"]
mattam_ has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
mattam_ is now known as mattam
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
ionOS has quit ["Using KVIrc 3.0.1 'System Virtue'"]
srv_ has quit [Read error: 104 (Connection reset by peer)]
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
CosmicRay has joined #ocaml
skylan has quit [Connection timed out]
chimikal_ has joined #ocaml
buggs^z has joined #ocaml
buggs has quit [Nick collision from services.]
buggs^z is now known as buggs
skylan has joined #ocaml
Tarka has quit [Read error: 54 (Connection reset by peer)]
chimikal_ has quit ["good bye"]
cjohnson has quit [Success]
cjohnson has joined #ocaml
srv has joined #ocaml
smimou has quit ["?"]
smimou has joined #ocaml
vezenchio has joined #ocaml
skylan has quit [Read error: 60 (Operation timed out)]
CosmicRay has quit [Read error: 113 (No route to host)]