asquii has joined #ocaml
asqui has quit [Connection timed out]
asquii is now known as asqui
pattern_ has left #ocaml []
tortoise_ has joined #ocaml
tortoise_ has quit [Client Quit]
asquii has joined #ocaml
asqui has quit [Connection timed out]
asqui has joined #ocaml
asquii has quit [Read error: 110 (Connection timed out)]
asquii has joined #ocaml
asquii has quit [Read error: 104 (Connection reset by peer)]
asquii has joined #ocaml
asqui has quit [Connection timed out]
asquii is now known as asqui
atom-z has quit ["Client Exiting"]
vegai_ has joined #ocaml
vegai has quit [Read error: 104 (Connection reset by peer)]
baader has quit ["I'll be back"]
<phubuh> how do i specify that a variable holds instances of a certain class?
<phubuh> `val foo: myclass = bar' gives `Unbound type constructor myclass'
<phubuh> or maybe i should use a constraint?
<phubuh> i'm not sure why ocamlc can't infer the type
<brwill> # class foo = object end;;
<brwill> class bar f:foo = object val foo_inst = f end;;
<brwill> specify type when you define the argument; otherwise it's polymorphic
vegai_ has quit [Remote closed the connection]
vegai has joined #ocaml
<phubuh> does the `method' keyword behave roughly like the `fun' keyword?
<phubuh> e.g., can i do method plus = (+) x and use it as 4 = ((new foo 2)#plus 2)?
<brwill> yes, method is analogous to fun afaik; the internals may differ (I'm in my novitiate myself, so I can't be certain ;)
brwill is now known as brwill|zzz
whee has quit ["Leaving"]
systems has joined #ocaml
systems has quit ["Client Exiting"]
docelic has joined #ocaml
docelic has quit [";"]
cm has joined #ocaml
<cm> :o
<phubuh> how do i explicitly declare the type of a function?
<mellum> (expr: type)
<phubuh> what is expr in this case?
<phubuh> let (foo: () -> ()) () = ()
<mellum> usually, you will want to declare the types of the arguments, as in let f (x: int) (y: int) = x < y;;
<phubuh> yeah. i thought i needed to declare the return value, but by declaring an argument, it could infer it
<phubuh> thanks :-)
<mellum> if you want to give the type of the whole function you probably need let f = (fun x y -> ...): type
<mellum> but there is usually no point in doing that... why do you need it?
<phubuh> i realized i didn't
<mellum> I mean declaring types *anywhere* is usually not needed
<phubuh> oh
<phubuh> i have several modules, and i compile them separately
<phubuh> and sometimes, i don't use it 'enough' inside the module for it to infer
<mellum> Hm, do you have .mli files?
<phubuh> no, i suppose i should :-)
<mellum> Yes, I think that's a better way
<mellum> Doing without .mlis is somewhat fragile
<phubuh> i see
<mellum> although, for lazyness reasons, I usually try to do without them as long as possible :)
<phubuh> :-)
<mellum> There's a switch for the compiler to print all types, so at least it's easy to generate an initial .mli file
<phubuh> oh, nice
<phubuh> uhm, ocamlcp doesn't seem to work very well
two-face has joined #ocaml
two-face has quit [Client Quit]
docelic has joined #ocaml
vegai has quit [Remote closed the connection]
vegai has joined #ocaml
vegai has quit [Remote closed the connection]
docelic has quit [" l8r"]
vegai has joined #ocaml
docelic has joined #ocaml
foxster has quit [Connection timed out]
docelic has quit ["later"]
docelic has joined #ocaml
ragzter has joined #ocaml
docelic has quit ["Client Exiting"]
smklsmkl has joined #ocaml
vegai has quit [Remote closed the connection]
smklsmkl is now known as smkl
vegai has joined #ocaml
docelic has joined #ocaml
baader has joined #ocaml
smkl has quit [Killed (NickServ (ghosted: smkl_!sami@CCCXXX.rdyn.saunalahti.fi))]
<baader> sockets ....
<baader> are there any wrappers available, code that i can use ?
<Smerdyakov> You mean there are no standard OCaml modules for sockets?
<baader> yes
<Riastradh> Yes there are.
<Smerdyakov> That's odd. SML has 'em, and I think OCaml is usually the better equipped one. :)
<baader> hm
<baader> so where would i start
<baader> i mean, where can i find modules for sockets ?!
<baader> thanks
<baader> oyes, that's it
<Smerdyakov> Ha! The OCaml interface is way messy compared to the SML Basis interface.
<Smerdyakov> It doesn't even distinguish between listening sockets and regular ones.
polin8 has quit [Read error: 54 (Connection reset by peer)]
<Riastradh> Smerdyakov, it's just a basic wrapper around BSD sockets, I think.
<Smerdyakov> I would prefer that there also be a high level module like SML's Socket.
vegai has quit [Remote closed the connection]
<Riastradh> There _is_ a high level interface.
vegai has joined #ocaml
<Smerdyakov> I'm glad
<baader> # let bla = () ;;
<baader> val bla : unit = ()
<baader> # let ble () = () ;;
<baader> val ble : unit -> unit = <fun>
<baader> Q: semantically both funs do the same, right ? take no args and return no args ?
<Smerdyakov> Funs?
<Smerdyakov> bla as defined is not a function.
<vegai> ble "takes" a unit
<Smerdyakov> ble is a function.
<baader> ok right bla is not a function
<vegai> is it wrong to think that let x = 1;; is a function x that returns 1?
<Smerdyakov> Yes.
<vegai> why so?
<Smerdyakov> Because it's not a function.
<vegai> tautology?
<Smerdyakov> "Function" has a specific meaning in the terminology of ML.
<baader> i'm trying to figure out what would be the 'correct' equivalent of a bla void() { ... }; in C
<Smerdyakov> What is a "bla void()"? Do you mean "void bla()"?
<vegai> you mean void bla()
<baader> uh yes
<Smerdyakov> That would be a function of type unit -> unit
<baader> why pls
<vegai> is there any practical difference then?
<mellum> (actually, in C, that is a function taking an unnknown number of arguments)
<Smerdyakov> baader, because there is no input and no output.
<Smerdyakov> mellum, nope.
<Smerdyakov> mellum, notice the { ... }. An empty argument list in a _definition_ really means void.
foxster has joined #ocaml
<Smerdyakov> mellum, in a _declaration_, it would have the meaning you said,
<baader> no that would be a bla void (...);
<baader> oops void bla (...);
<vegai> I can't think of any reason to use that sort of functions in ocaml
<Smerdyakov> vegai, you've never used references or arrays?
<mellum> Smerdyakov: also in a definition, although it makes mo sense, admittedly. gcc compiles int f() { return f("bla", 3); } without any warning
<vegai> Smerdyakov: how do those fit this picture?
<Smerdyakov> vegai, a unit -> unit can have effects via references and arrays
<baader> that's the intended use of it later on, Smerdyakov
<Smerdyakov> mellum, this is standard or a gcc "extension"? ;)
<baader> but currently the fun is just a stub and does nothing
<mellum> Smerdyakov: Compaq's compiler also accepts it, although it gives an "info" level warning
<Smerdyakov> mellum, I don't think compiler acceptance counts much for explaining the standard.
<vegai> side effects
<vegai> well... I guess they are practical once and a while
<Smerdyakov> vegai, the phrase is "once in a while."
<vegai> Smerdyakov: =)
<baader> void bla(int one, ... ) <- but this is not what i'm looking for
<vegai> what are you looking for?
<vegai> ie. what are you trying to do?
<baader> Smerdyakov has answered it already, a unit -> unit is probably the correct void bla ();
<baader> carry out side effects
<vegai> yup, that's it then
<baader> thanks :)
<Smerdyakov> If you don't want any side effects, you shouldn't be using OCaml. :P
<baader> i do want side effects
<vegai> that was for me, I reckon
<baader> :>
<baader> FP ppl tend to have confusing terminology "side effects" ...
<Smerdyakov> baader, why is it confusing?
<vegai> I think it's pretty clear
<vegai> even intuitive
<baader> because "side effects" are what imperative langs are composed of, so i guess there's no special term to describe the process of just changing some variables
<Smerdyakov> So you mean it's confusing to someone who is used to imperative languages and doesn't want to think about things in a different way? ;)
<baader> heh yes
<vegai> damn IRC
<baader> int i; void bla () { i = 10 ;} is ususally not described as a "function that carries out SIDE EFFECTS ! so watch it !" in C
<Riastradh> bla() _does_ have side effects, though.
<baader> yes, but usally in C terms it doesn't get special attention, even tho technically that would be a correct description
<Smerdyakov> They're different definitions in different communities, Riastradh.
<baader> yep
<baader> well thanks for your attention, i'm sorry about stupid newbi questions
<vegai> I like Ocaml's way of not restricting side effects a bit more for the moment at least
<Smerdyakov> These have not been stupid questions. :)
<baader> :)
brwill|zzz is now known as brwill
<vegai> that side effect in bla() is quite icky
<vegai> even so icky that most beginner-level programming courses advise against such
<Smerdyakov> I think anything further that you say on this subject will be decidedly non-constructive, vegai. :P
<vegai> huh?
<vegai> I wasn't aware this was flammable
<Smerdyakov> Not "flammable," but "pointless."
* vegai looks at Smerdyakov.
<vegai> is everything ok?
<Smerdyakov> I don't think there is any question that using global variables is confusing, so why are you making a case for it?
<Riastradh> 'Flammable' isn't a word.
<vegai> so... everything is ok?
<Smerdyakov> Riastradh, is so
<Smerdyakov> vegai, yes. Why do you ask?
<Riastradh> No; the word you probably meant to use is 'inflammable.'
<vegai> good =) nothing further, your honor
<vegai> oh sheesh. That's ridiculous, Riastradh
* vegai off to late lunch.
<baader> i'm struggling w/ english, french comments in other ppls source code AND OCaml :>
<Riastradh> Smerdyakov, ok, and what makes 'WordNet' authoritative on the subject?
<Smerdyakov> Riastradh, what makes whatever sources you're claiming more authoritative?
* vegai makes a mental note to give Riastradh a big hell for every typo he will make.
<Smerdyakov> vegai, "a big hell" is not something a native English speaker would usually say.
<Smerdyakov> More likely "give someone hell"
<Riastradh> Smerdyakov, are you suggesting that we ought to just go along with whatever trash any dork like Webster sprays into the public?
<Smerdyakov> Riastradh, yes
<vegai> Smerdyakov: ehh.
* vegai makes a mental not to give Smerdyakov _hell_ as well.
<Riastradh> Then at least call whatever garbage you speak not 'English' but instead 'American.'
<vegai> Riastradh: whatever is not a french word.
<Riastradh> vegai, I was not speaking French.
<Riastradh> Or typing, rather.
<vegai> oh, what were you typing?
<Riastradh> English.
<vegai> I don't think you are... I think you will need to prove that right now, so we can end this useless debate
<Riastradh> I speak English as defined by the OED.
<vegai> are you certain?
<Riastradh> Quite.
<Smerdyakov> I'd just drop it, vegai. Riastradh is a seriously disturbed individual.
<vegai> that's far from proof -- and the debate lives on.
<Riastradh> ...says the schizophrenic.
<Smerdyakov> I'm seriously disturbed in different ways.
<Smerdyakov> I prefer my ways.
<baader> .oO( a perfect example of chaos theory .. you ask a simple question and get an earthquake in return )
foxen has joined #ocaml
foxster has quit [Connection timed out]
mrvn_ has joined #ocaml
vegai has quit [Remote closed the connection]
mrvn has quit [Read error: 60 (Operation timed out)]
vegai has joined #ocaml
<baader> aehem
<baader> is there a vector<T> equivalent ? Arrays so seem to be fixed in size once allocated
<Riastradh> OCaml doesn't have stretchy vectors.
<Riastradh> It's trivial to write a 'resize' function, though.
vegai has quit [Remote closed the connection]
vegai has joined #ocaml
<Riastradh> let resize arr new_size init = let new_arr = Array.make new_size init in Array.blit arr 0 new_arr 0 new_size; new_arr
<baader> yes, but that involves copying all the elements, doesn't it ?
<mellum> just like vector<T>
<baader> depends on how vector is implemented really
<mellum> Okay, it also has a "capacity" which can be larger than the size... but you could also easily implement that
<baader> ok
<mellum> I think there's a library for it somewhere
<baader> no for now i'm fine with a fixed-size array, i was just wondering if there's such a thing
<baader> ie. somethinf that's already included
<baader> -f+g
vegai has quit [Remote closed the connection]
docelic has quit ["brb"]
polin8 has joined #ocaml
vegai has joined #ocaml
Demitar has joined #ocaml
docelic has joined #ocaml
Demitar has quit [Read error: 113 (No route to host)]
ragzter has quit ["booting to linux"]
TimFreeman has joined #ocaml
TimFreeman has left #ocaml []
vegai has quit [Remote closed the connection]
vegai has joined #ocaml
vegai has quit [Remote closed the connection]
reffie has quit [Read error: 104 (Connection reset by peer)]
vegai has joined #ocaml
tortoise_ has joined #ocaml
tortoise_ is now known as sylow
baader has quit [niven.freenode.net irc.freenode.net]
vegai has quit [niven.freenode.net irc.freenode.net]
tortoise has quit [niven.freenode.net irc.freenode.net]
lam has quit [niven.freenode.net irc.freenode.net]
themus has quit [niven.freenode.net irc.freenode.net]
brwill has quit [niven.freenode.net irc.freenode.net]
skylan has quit [niven.freenode.net irc.freenode.net]
vegai has joined #ocaml
lam has joined #ocaml
themus has joined #ocaml
brwill has joined #ocaml
skylan has joined #ocaml
baader has joined #ocaml
whee has joined #ocaml
sylow is now known as tortoise
mattam_ has quit [Read error: 110 (Connection timed out)]
docelic has quit ["Client Exiting"]
vegai has quit ["Väkeä väsyttelevi, rahvahaista raukaisevi: kaikki nukkui..."]
docelic has joined #ocaml
foxen has quit [Connection timed out]
systems has joined #ocaml
systems has quit ["Client Exiting"]
docelic has quit ["Client Exiting"]
pnou has joined #ocaml
<pnou> hi
<Riastradh> Hi.
<baader> hallo
bes_ has joined #ocaml
brwill is now known as brwill|store