struktured has quit [Read error: Connection reset by peer]
<thelema>
so yes
avsm has quit [Quit: Leaving.]
<flux>
well, the numbers seem reasonable
<flux>
mayba compare_val and caml_equal could be shaven a bit
<flux>
but GC is still the big part.
<flux>
actually I wonder about ml_z_mul
<flux>
it calls caml_alloc_custom a lot?
<flux>
but, maybe it cannot be avoided
<flux>
I guess it calls always exactly once
<flux>
+it
<flux>
maybe you could nevertheles try playing with the GC parameters
<flux>
space_overhead sounds relevant
<thelema>
well, the alternative is to try using gmp directly and see what results I get.
<thelema>
but I'm busy on another project, so I'll probably leave the computation of pi for another day
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
lopexx has joined #ocaml
lopex has quit [Ping timeout: 245 seconds]
lopexx is now known as lopex
arubin has joined #ocaml
Cyanure has quit [Remote host closed the connection]
sebz_ has quit [Quit: Computer has gone to sleep.]
yezariaely has joined #ocaml
yezariaely has quit [Client Quit]
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
avsm has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
jimi_hendrix has joined #ocaml
<jimi_hendrix>
hello, i asked this yesterday but got no response. I am new to OCaml, and I keep reading about how objects/classes in OCaml are used differently than in languages like C++ or Java, but articles/tutorial never elaborate as to how they are to be used. When should i use a record and when should i use an object?
<thelema>
jimi_hendrix: When you need subtyping, use objects
<thelema>
otherwise, records work well.
<jimi_hendrix>
alright
<thelema>
maybe there's some other times that objects are better than records in ocaml, but I can't think of them at the momoent.
<jimi_hendrix>
also, is it common practice to make record constructor-type functions as a short hand, or to just write out the record?
<thelema>
That said, this doesn't mean that one should take a java program and replace objects with records to make a good ocaml program
<thelema>
It's pretty common practice, but either is fine.
<jimi_hendrix>
thelema, ok
<jimi_hendrix>
thelema, err making constructor functions is common practice?
<thelema>
yes
<jimi_hendrix>
ok
<jimi_hendrix>
is there a typical naming scheme for those, like new_<record name>?
ulfdoz has quit [Ping timeout: 258 seconds]
<thelema>
usually just the name of the record type
<thelema>
here's some code I'm working on right now:
<thelema>
let estimate p u l c = {point=p; upper=u; lower=l; confidence=c}
<jimi_hendrix>
oh, ocaml can tell the difference? cool
ulfdoz has joined #ocaml
<jimi_hendrix>
thelema, one more question for the time being then. with an object, is it possible to access a property without creating getter and setter functions?
<thelema>
no, it's not.
<jimi_hendrix>
ok
<jimi_hendrix>
mildly annoying
<thelema>
only if you use objects for things that shouldn't be objects
<thelema>
use records and tuples for most things
<jimi_hendrix>
right
ulfdoz has quit [Ping timeout: 260 seconds]
<_habnabit>
normally I create my constructors as `let estimate point upper lower confidence = {point; upper; lower; confidence}`
imp__ has quit [Ping timeout: 248 seconds]
ygrek has joined #ocaml
dirkD has joined #ocaml
<thelema>
_habnabit: yes, I'm still using 3.11-isms
<thelema>
_habnabit: that way is better in 3.12+
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
wormphlegm has quit [Remote host closed the connection]
yezariaely has joined #ocaml
arubin has quit [Ping timeout: 240 seconds]
lpereira has quit [Read error: Connection reset by peer]
arubin has joined #ocaml
wormphlegm has joined #ocaml
<jimi_hendrix>
uhh?
<jimi_hendrix>
is there a difference other than appearance?
ulfdoz has joined #ocaml
<thelema>
jimi_hendrix: no difference in what it compiles to, just taking advantage of new 3.12 feature that {foo} means {foo=foo}
<adrien>
before it had to be { point = point; upper = upper; ... } and because of some rules for records (unique field names in a module), it might also have been { foo_point = point; upper = upper; foo_lower = lower ... }
<Qrntzz>
just wondering, should widget types in a widget toolkit written in ocaml be objects?
<Qrntzz>
afaik, every popular gui toolkit there is uses objects
<adrien>
you're building your own?
<Qrntzz>
yes, it's nothing large-scale and I don't need lablgtk or labltk
<thelema>
Qrntzz: one might argue that objects were added to caml light exactly for gui toolkits.
<adrien>
what's the base?
<Qrntzz>
sdl
<adrien>
thelema: I'd say lablgtk was created as an example/support for Garrigues' work ;-)
<Qrntzz>
in fact, I'm writing a server browser for a game
<adrien>
I can't help but warn you that even trivial stuff is a huge amount of work for gui toolkits
<adrien>
anyway
<adrien>
my answer to your original question would be: no
<Qrntzz>
so as the game needs sdl to work too, they share dependencies, not to mention I'va had experience with sdl before
<Qrntzz>
so would you advise using records?
<adrien>
it really depends how you're doing it
<adrien>
but if you get to the point you _really_ need objects because you have more than 3 or 4 cases to handle, you're probably heading to too much work
<Qrntzz>
I have just about 5 widget types
yezariaely has quit [Quit: Leaving.]
<adrien>
in other words: objects would be better, especially in the long run, but I hope you won't get that far
<adrien>
(did I mention I was working on lablgtk myself? :-) )
<Qrntzz>
what I basically need is a simple widget toolkit + the app itself before december :-)
<Qrntzz>
I guess no, but that's certainly nice to hear
avsm has quit [Quit: Leaving.]
ztfw has quit [Remote host closed the connection]
struktured has joined #ocaml
edwin has quit [Remote host closed the connection]
dnolen has quit [Quit: dnolen]
Snark has quit [Quit: Quitte]
struktured has quit [Ping timeout: 276 seconds]
jamii has joined #ocaml
joewilliams_away is now known as joewilliams
hto has quit [Quit: Lost terminal]
lamawithonel has quit [Read error: Operation timed out]
dnolen has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
lamawithonel has joined #ocaml
dnolen has quit [Client Quit]
ygrek has quit [Remote host closed the connection]
Anarchos has joined #ocaml
Skolem has quit [Ping timeout: 248 seconds]
dirkD has quit [Ping timeout: 255 seconds]
joewilliams is now known as joewilliams_away
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]