Banana changed the topic of #ocaml to: OCaml 3.08 "Bastille Day" Release available ! -- 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
cjohnson has quit [Read error: 110 (Connection timed out)]
GreyLensman has joined #ocaml
<dj-death> does someone know how to check the value of a socket () call ?
<dj-death> I have got this error when trying to check if socket == -1
<dj-death> This expression has type int but is here used with type Unix.file_descr
cjohnson has joined #ocaml
<monochrom> If socket() fails, IIRC, an exception is thrown instead of the C convention of returning some funny number -1.
<dj-death> ok thx
<dj-death> monochrom: how to know that ?
<dj-death> monochrom: I used to parse headers as I do in C
<dj-death> monochrom: but files in /usr/lib/ocaml just give types informations
<dj-death> monochrom: none of them describe exceptions
* Riastradh coughs at Smerdyakov.
<dj-death> thx
Xolution has quit [Read error: 60 (Operation timed out)]
monochrom has quit ["Don't talk to those who talk to themselves."]
Xolution has joined #ocaml
yauz_ has joined #ocaml
yauz has quit [Read error: 60 (Operation timed out)]
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
jdrake has joined #ocaml
pac_away has joined #ocaml
pac_away has left #ocaml []
Xolution has quit [Read error: 110 (Connection timed out)]
Xolution has joined #ocaml
jdrake has quit [Read error: 110 (Connection timed out)]
cjohnson has quit [Read error: 110 (Connection timed out)]
jdrake has joined #ocaml
Xolution has quit [Read error: 110 (Connection timed out)]
Xolution has joined #ocaml
Xolution has quit [Read error: 104 (Connection reset by peer)]
cjohnson has joined #ocaml
GreyLensman has quit ["Leaving"]
monochrom has joined #ocaml
debona|r has joined #ocaml
mrsolo_ has joined #ocaml
cjohnson has quit [Remote closed the connection]
Herrchen has joined #ocaml
Herrchen_ has quit [Read error: 60 (Operation timed out)]
<jdrake> if I have: class galactica () = object ... end;; shouldn't galactica () instantiate the object?
<Riastradh> No. You use neww.
<Riastradh> neww, even.
<Riastradh> Argh.
<Riastradh> new
<jdrake> i remember reading up on objects it did something like I described, but I see now in the documentation that I didn't look at that it is done the other way
avn has quit [Read error: 113 (No route to host)]
<jdrake> any ideas why I might get "Unbound value sprinf" on line 20 in http://rafb.net/paste/results/EV2pEE86.html ?
<jdrake> i tried it in the top level and have no problems
<monochrom> sprinf != sprintf
<jdrake> i need a shot of vodka I guess
debona|r has quit [Read error: 60 (Operation timed out)]
<jdrake> thank you mate
<monochrom> Someone should contribute ocaml and haskell language support to the paste site.
<jdrake> i don't know enough of the language for that and BNF gives me headache
<jdrake> is it not possible to use a ^ concatenated string as a formatted string to sprinf? I know special processing is used for it. I have a longer string I need to break between lines
<monochrom> printf and sprintf are handled by some magic that doesn't mix well with ^ or non-literals for that matter.
<jdrake> so there isn't any way then...
<monochrom> Right.
<jdrake> too bad it is magical
<jdrake> and this is annoying: Warning: this expression should have type unit.
<fluxx> ignore (expression)
<Smerdyakov> So use an expression that has type unit....
<monochrom> Unlike C, the ocaml compiler wants to pin down the number and types of the parameters at compile time. So at compile time it has to parse the format string.
<fluxx> I suspect it might be possible to create those format4-objects dynamically somehow..
<Smerdyakov> There is a ^^ operator in 3.07+.
<jdrake> i don't like having any errors or warnings come out
<Smerdyakov> jdrake, you don't get any if you code it properly.
<jdrake> ^^ works
<monochrom> ^_^
<Smerdyakov> jdrake, fluxx was telling you about the ignore function, which is useful for getting rid of the warning you mentioned.
<jdrake> i suppose I could use exceptions instead of returning true and false
<Smerdyakov> Are you even paying attention to what we're saying?
<jdrake> yes I am
<Smerdyakov> This isn't a joke. "ignore" is a real OCaml function....
<jdrake> primarily your statement: "you don't get any if you code it properly"
<Smerdyakov> So you wrap a call to ignore around whatever expression is causing the warning.
<jdrake> is it customary to throw exceptions rather then use boolean return values?
<Smerdyakov> That question is too general to have an answer.
<jdrake> it is a perfectly valid question on style commonly used
<Smerdyakov> If you often don't look at the return value, then exceptions certainly make more sense, though.
<Smerdyakov> If you always look at the return value, then avoiding exceptions is probably a good goal.
<Smerdyakov> But without more information, your question is like "is it customary to use integers rather than functions?".
<jdrake> it wasn't that bad of question
<monochrom> "is this file writable?" I expect this to be boolean, no exception. "write stuff to this file" I expect this to throw exceptions
<fluxx> atleast in other languages exceptions are used for, well, exceptional conditions, errors and such
<fluxx> it appears ocaml has a bit extended this tradition by throwing for example 'end of file' which happens for every file
<fluxx> albeit, only once
<jdrake> i do like that end of file exception
<fluxx> I would like ocaml to have some kind of way to catch all exceptions, and then rethrow the unknown exception forward
yauz_ is now known as yauz
<fluxx> let's say you have let foo f = Mutex.lock m; f (); Mutex.unlock f;; - if f throws an exception the mutex will be locked forever
<fluxx> return values have return paths that are more easily seen
<monochrom> Ah, but you want a "finally" kind of clause for that.
<fluxx> well, c++ has "try { throw 42; } catch (...) { bar(); throw; } for that
<jdrake> MSVC has a __finally I believe
<fluxx> another option would be to have scoped destructors for objects ;)
<Smerdyakov> fluxx, you _can_ catch all exceptions and rethrow with try whatever with ex -> raise ex
<Smerdyakov> fluxx, but is that what you meant?
<fluxx> hm
<fluxx> so 'ex' just matches anything?
<fluxx> that is exactly what I meant ;)
<Smerdyakov> Right. try ... catch ... is syntactic sugar for a simpler form that always has exactly one matching case, which matches a variable.
<Smerdyakov> A regular match expression is used on this variable with the rules you specify.
<Smerdyakov> So the full generality of patterns is usable.
<fluxx> I didn't realize the with-clauses used pattern matching, perhaps I should browse through the bnf some beautiful sunny day
<jdrake> fluxx, haven't you done with _ -> ?
<fluxx> nope
<monochrom> Ah, you don't know the ecstasy of ignoring all exceptions in one swoop...
<monochrom> You are so pure.
<fluxx> now I shall do that always!
<jdrake> monochrom, haskell is the only pure
<monochrom> Now you are tainted.
<fluxx> another thing missing would be hierarchical exceptions, but I suspect one could emulate those with pattern matching
<jdrake> is it possible to even go back to a language that is pattern matching free? (C is so weak)
_fab has joined #ocaml
jdrake has quit [Read error: 110 (Connection timed out)]
smkl has quit [Read error: 60 (Operation timed out)]
zigong__ has quit [Read error: 110 (Connection timed out)]
zigong has joined #ocaml
monochrom has quit ["Don't talk to those who talk to themselves."]
vincenz has quit ["leaving"]
smkl has joined #ocaml
smimou has joined #ocaml
binary42 has joined #ocaml
vezenchio has joined #ocaml
kosmikus|away is now known as kosmikus
ionOSu has joined #ocaml
slashvar[away] is now known as slashvar[lri]
<slashvar[lri]> Yop
smkl_ has joined #ocaml
ita has joined #ocaml
<ita> grut
<Robert> Yes, sure.
smkl has quit [Read error: 110 (Connection timed out)]
smkl_ is now known as smkl
ionOSu has quit ["Leaving"]
dj-death has quit ["leaving"]
dj-death has joined #ocaml
ita has quit ["i'll be back"]
cjohnson has joined #ocaml
cjohnson has quit [Read error: 54 (Connection reset by peer)]
cjohnson has joined #ocaml
smimou has quit ["?"]
smimou has joined #ocaml
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
smimou has quit ["?"]
smimou has joined #ocaml
Zxcvb has joined #ocaml
<Zxcvb> is it possible to run an ocaml app "compiled" for linux/x86 on say, OS X just by telling the interpeter the correct offset of where the app begins (and interpreter ends)
<dj-death> what does it mean : Warning: this function application is partial, ?
<fluxx> zxcvb, if it's not natively compiled, I would imagine it is possible
<fluxx> but you need to know what you're doing to make that happen ;)
<fluxx> dj-death, let's say you have let bar baz = baz + 1;;
<fluxx> if you have code that does baz; 42 it would say that because you applied baz partially
<fluxx> I guess you have a function such as let foo () = 42; but you call it with only foo (not foo ())
<fluxx> I imagine that diagnostics is given whenever a function returns a function, which is not used for anything (and not ignored with ignore)
<dj-death> ohhh
<dj-death> thx
pac_away has joined #ocaml
<dj-death> fluxx: I write 2 method in a class
<dj-death> the first :
<dj-death> method send_string str =
<dj-death> write sock str (String.length str)
<dj-death> the second :
<dj-death> method send_string_list list =
<dj-death> match list with
<dj-death> [] -> ()
<dj-death> | e::r -> self#send_string e ; self#send_string_list r
<dj-death> ocamlopt print this warning for : self#send_string e
<dj-death> Warning: this function application is partial,
<dj-death> maybe some arguments are missing.
pac_away has left #ocaml []
<fluxx> so, does write take three arguments?
<smimou> val Unix.write : file_descr -> string -> int -> int -> int
<fluxx> no, it takes 4
<dj-death> ?
<dj-death> send_string takes only one argument
<fluxx> refer to ocaml documentation on Unix-module's write-function ;)
<Zxcvb> fluxx: ocalm isn't interpreted like zcode or java?
<fluxx> zxcvb, ocaml may be compiled to bytecode or to native assembler code
<dj-death> fluxx: there is nothing wrong with write
<fluxx> write sock str (String.length str)
<dj-death> fluxx: but with send_string
<Zxcvb> fluxx: I thought compiling an ocaml app like say, mlnet, was just the same as 'cat ocamlinterpreter mlnet.bin > mlnet'
<fluxx> are you giving write three or four arguments there?
<fluxx> how many arguments does write require?
<dj-death> fluxx: 3
<Zxcvb> fluxx: with mlnet.bin being the bytecode
<dj-death> fluxx: val write : file_descr -> string -> int -> int -> int
<dj-death> oups
<Zxcvb> fluxx: much like certain zork games are just the interpreter with the data/bytecode stuck on the end
<fluxx> write fd buff ofs len writes len characters to descriptor fd, taking them from string buff, starting at position ofs in string buff.
<dj-death> fluxx: thx a lot
vincenz has joined #ocaml
Lemmih has quit [Read error: 110 (Connection timed out)]
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
jdrake has joined #ocaml
Iter has quit [Read error: 110 (Connection timed out)]
Zxcvb has quit [Read error: 54 (Connection reset by peer)]
Lemmih has joined #ocaml
debona|r has joined #ocaml
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
jdrake has quit [Read error: 110 (Connection timed out)]
zigong has quit ["Leaving"]
debona|r has quit [Read error: 110 (Connection timed out)]
mrsolo_ has quit [Read error: 54 (Connection reset by peer)]
yauz has quit [Read error: 113 (No route to host)]
yauz has joined #ocaml
jdrake has joined #ocaml
monochrom has joined #ocaml
leolio has joined #ocaml
Lemmih_ has joined #ocaml
Lemmih has quit [Read error: 110 (Connection timed out)]
Lemmih_ is now known as Lemmih
maihem has joined #ocaml
jdrake has quit [Read error: 60 (Operation timed out)]
monochrom has quit ["Don't talk to those who talk to themselves."]
kosmikus is now known as kosmikus|away
leolio has quit [Read error: 110 (Connection timed out)]
netstar has joined #ocaml
netstar has left #ocaml []
CosmicRay has joined #ocaml
slashvar[lri] has quit [Remote closed the connection]
Xolution has joined #ocaml
cjohnson has quit [Read error: 60 (Operation timed out)]
cjohnson has joined #ocaml
pac_away has joined #ocaml
Xolution has quit [Read error: 110 (Connection timed out)]
pac_away is now known as pac_
Xolution has joined #ocaml
cjohnson has quit [Read error: 60 (Operation timed out)]
cjohnson has joined #ocaml
Xolution has quit [Read error: 60 (Operation timed out)]
Riastrad1 has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
Xolution has joined #ocaml
mattam has joined #ocaml
mattam_ has quit [Read error: 60 (Operation timed out)]
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
Nutssh has joined #ocaml
Nutssh has left #ocaml []
Xolution has quit [Read error: 110 (Connection timed out)]
Xolution has joined #ocaml
jdrake has joined #ocaml
gim has quit ["xchat-2.1"]
gim has joined #ocaml
cjohnson has quit [Connection timed out]
leolio has joined #ocaml
cjohnson has joined #ocaml
Xolution has quit [Read error: 110 (Connection timed out)]
monochrom has joined #ocaml
Xolution has joined #ocaml
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
Xolution has quit [Read error: 110 (Connection timed out)]
vezenchio has quit ["all that is necessary for the triumph of evil is for good men to do nothing"]
CosmicRay has quit ["Client exiting"]
Xolution has joined #ocaml
cjohnson has quit [Connection timed out]
maihem has quit ["Read error: 54 (Connection reset by chocolate)"]
Xolution has quit [Read error: 110 (Connection timed out)]
jdrake__ has joined #ocaml
jdrake__ has quit [Remote closed the connection]
leolio has quit [Read error: 60 (Operation timed out)]
smkl has quit [Read error: 110 (Connection timed out)]
_fab has quit [Read error: 110 (Connection timed out)]
Iter has joined #ocaml
vincenz has quit ["leaving"]
hellish has quit ["Leaving"]
monochrom has quit ["Don't talk to those who talk to themselves."]
cjohnson has joined #ocaml
smkl has joined #ocaml