<jourdechance>
how can i define the method "set" to set the mutable mutable "x" to the label "x"
<jourdechance>
?
CosmicRay has joined #ocaml
<Nutssh>
See the manual for labels. You can use something like (~x:xvar) to bind xvar to the argument with a label of x.
<jourdechance>
ok, thanks
TheDracle has quit [Read error: 110 (Connection timed out)]
<jourdechance>
but my problem is with an optional argument :/
<jourdechance>
i don't find something like ?(x:varx = 42)
<Smerdyakov>
Why do you want this?
CosmicRay has quit [Remote closed the connection]
<jourdechance>
i want to make that: let obj = object val mutable x = 42 method set ?(x = 17) () = x <- x end
<jourdechance>
obj#set () affect 17 to the mutable x.
<jourdechance>
is it possible ?
<Smerdyakov>
I don't know. Why not make a separate setDefault method?
Xolution has quit [Read error: 110 (Connection timed out)]
<Nutssh>
jourdechance, see the manual for labels, it also exiss for optional arguments.
Xolution has joined #ocaml
<Nutssh>
(?x:xvar) or something like that.
<jourdechance>
that's do not work in definition only when call the function
CosmicRay has joined #ocaml
<jourdechance>
Smerdyakov, because i have more than one optionnal arguments
<Smerdyakov>
Why do you have more than one optional argument?
<Nutssh>
You can use option arguments (thats how default arguments are done internally)
<Smerdyakov>
I thought optional arguments were done with default values.
<Nutssh>
From section 4.1.1 of the the ocaml docs: ''Optional arguments are actually implemented as option types. ''
<Smerdyakov>
It could be propaganda.
<Nutssh>
Ummmmmm....... uh huh.
<monochrom>
optional propaganda
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
CosmicRay has quit [Read error: 110 (Connection timed out)]
bk_ has joined #ocaml
yauz has joined #ocaml
Nutssh has quit [Read error: 60 (Operation timed out)]
<jourdechance>
Indeed the object it's an "rsa key" and the method take four integers p q e size, all of them are optionals
<jourdechance>
the defaut e is 65537, the default size 512 and if p and q are omitted they are generated randomly (and they are size bits length)
yauz_ has quit [Read error: 113 (No route to host)]
kinners has joined #ocaml
debona|r has joined #ocaml
mary has quit [Read error: 113 (No route to host)]
mary has joined #ocaml
debona|r has quit [Read error: 110 (Connection timed out)]
kinners has quit [Read error: 110 (Connection timed out)]
CosmicRay has joined #ocaml
cmeme has quit [Remote closed the connection]
cmeme has joined #ocaml
bk_ has quit ["leaving"]
jarod_ has joined #ocaml
jarod has quit [Read error: 54 (Connection reset by peer)]
cj has joined #ocaml
cjohnson has joined #ocaml
mrsolo has joined #ocaml
GreyLensman has quit ["Leaving"]
Xolution has quit [Read error: 60 (Operation timed out)]
cj has quit [niven.freenode.net irc.freenode.net]
mary has quit [niven.freenode.net irc.freenode.net]
mattam has quit [niven.freenode.net irc.freenode.net]
CosmicRay has quit [niven.freenode.net irc.freenode.net]
slashvar[away] has quit [niven.freenode.net irc.freenode.net]
det has quit [niven.freenode.net irc.freenode.net]
Hadaka has quit [niven.freenode.net irc.freenode.net]
avn has quit [niven.freenode.net irc.freenode.net]
Hipo has quit [niven.freenode.net irc.freenode.net]
cj has joined #ocaml
CosmicRay has joined #ocaml
mary has joined #ocaml
mattam has joined #ocaml
slashvar[away] has joined #ocaml
det has joined #ocaml
Hadaka has joined #ocaml
avn has joined #ocaml
Hipo has joined #ocaml
cj has quit [Connection timed out]
cj has joined #ocaml
CosmicRay has quit [Connection timed out]
Nutssh has joined #ocaml
FredCods has quit ["Lost terminal"]
Xolution has joined #ocaml
cj has quit [Read error: 60 (Operation timed out)]
cjohnson has quit [Read error: 104 (Connection reset by peer)]
Nutssh has quit [Read error: 110 (Connection timed out)]
mrsolo has quit [Read error: 104 (Connection reset by peer)]
Tachyon76 has joined #ocaml
mrsolo has joined #ocaml
smkl has quit [Read error: 110 (Connection timed out)]
mflux_ has joined #ocaml
jourdechance has quit [niven.freenode.net irc.freenode.net]
pattern has quit [niven.freenode.net irc.freenode.net]
mflux has quit [niven.freenode.net irc.freenode.net]
sic- has quit [niven.freenode.net irc.freenode.net]
j_n has quit [niven.freenode.net irc.freenode.net]
sic- has joined #ocaml
pattern has joined #ocaml
j_n has joined #ocaml
jourdechance has joined #ocaml
Tachyon76 has quit [Client Quit]
efficxpert has joined #ocaml
smkl has joined #ocaml
efficxpert has quit ["Leaving"]
kosmikus|away has quit [Read error: 110 (Connection timed out)]
mattam_ has joined #ocaml
Xolution has quit ["Leaving"]
mattam has quit [Read error: 110 (Connection timed out)]
vezenchio has joined #ocaml
monochrom has quit ["Don't talk to those who talk to themselves."]
smkl has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
smkl has joined #ocaml
withersoever has joined #ocaml
mattam_ is now known as mattam
smkl_ has joined #ocaml
smkl has quit [Read error: 110 (Connection timed out)]
vezenchio has quit ["I thought what I'd do was, I'd pretend I was one of those deaf-mutes ^_^"]
vezenchio has joined #ocaml
smkl_ is now known as smkl
slashvar[away] has quit [Read error: 104 (Connection reset by peer)]
jarod_ has quit [Read error: 104 (Connection reset by peer)]
Bols`away has joined #ocaml
<Bols`away>
hi people
<jourdechance>
hi you :)
jourdechance has quit ["Leaving"]
smkl has quit [Read error: 110 (Connection timed out)]
jourdechance has joined #ocaml
bk_ has joined #ocaml
smkl has joined #ocaml
CosmicRay has joined #ocaml
cjohnson has joined #ocaml
Nutssh has joined #ocaml
monochrom has joined #ocaml
smkl has quit [Read error: 110 (Connection timed out)]
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
Nutssh has quit [Read error: 110 (Connection timed out)]
Nutssh has joined #ocaml
smkl has joined #ocaml
mrsolo has quit [Read error: 60 (Operation timed out)]
joel_ has joined #ocaml
jrosdahl has quit [Read error: 110 (Connection timed out)]
Nutssh has quit [Read error: 60 (Operation timed out)]
joel_ is now known as jrosdahl
CosmicRay has quit ["Client exiting"]
smkl has quit ["changing servers"]
smkl has joined #ocaml
Nutssh has joined #ocaml
monochrom has quit ["Don't talk to those who talk to themselves."]
monochrom has joined #ocaml
smkl has quit [Read error: 110 (Connection timed out)]
Nutssh has quit [Read error: 60 (Operation timed out)]
sb98052 has joined #ocaml
<sb98052>
what does a type-expr::=type1 type2 mean in a method definition? eg. method compute (r: reg) : value action
<sb98052>
i.e., why are there two types in the type signature of compute... does it mean value*action ?
<mellum>
that's legal?
<mellum>
maybe action is a paremterized type
<mellum>
so it's like "int list"
<sb98052>
nope...
<sb98052>
two different types...
<sb98052>
i think i get it. it means type1 | type2 ...
<sb98052>
putting them one after the other just concatenates the type spaces (maybe, if i understand right)
<mellum>
Hm, I've never needed methods
Nutssh has joined #ocaml
monochrom has quit ["Don't talk to those who talk to themselves."]
monochrom has joined #ocaml
Nutssh has quit ["Client exiting"]
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
TheDracle has joined #ocaml
CosmicRay has joined #ocaml
gl has joined #ocaml
CosmicRay has quit ["Client exiting"]
smkl has joined #ocaml
<sb98052>
how does one insert a print_string for logging etc. in a function? i just did a let x = print_string log_data <actual_return_value> is there a better way?
<Smerdyakov>
That doesn't look like it will compile.
<sb98052>
it does... and works fine...
<sb98052>
sorry missed the 'in'
<sb98052>
let x = print_string var.vname in SKIP_CHILDREN where SKIP_CHILDREN is the value i want to return
<Smerdyakov>
You could just do: print_string var.vname; let x = SKIP_CHILDREN in ...
<sb98052>
x!=skip_children. x is a junk value...
<Smerdyakov>
Fine. Then print_string var.vname; SKIP_CHILDREN
<sb98052>
that doesn't compile.
<Smerdyakov>
It depends on the context. What's around that code?
<sb98052>
it complains on 'print_string var.vname' saying 'type of method is ACTION'
<sb98052>
and 'SKIP_CHILDREN' is an action...
<Smerdyakov>
I ened to know the context to help you, and that is different from the error message you get.