<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.'