vect changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn, ICFP'03 http://www.icfpcontest.org/, 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
Defcon7 has quit [Remote closed the connection]
<drWorm> unlambda, interesting :)
<blueshoe> heh
<blueshoe> "It's disgusting --- it's revolting --- we love it." CyberTabloid
Defcon7 has joined #ocaml
wazze has quit ["If we don't believe in freedom of expression for people we despise, we don't believe in it at all -- Noam Chomsky"]
<Smerdyakov> Can I easily make ocamldebug give a stack backtrace when there's a stack overflow?
<async> Smerdyakov: did you try OCAMLRUNPARAM=b
<Smerdyakov> I am now. I RTFM. :)
<Smerdyakov> Thanks though
<async> you know it
<async> Smerdyakov are you usually in your soda office?
<Smerdyakov> No, I'm rarely there. I might use it more this semester.
<async> as my personal java tutor? ;)
<Smerdyakov> They have this fancy drop-in tutoring system set up, you know.
<async> where
<async> very interesting indeed
teratorn has joined #ocaml
Herrchen has quit [Read error: 110 (Connection timed out)]
Kinners has joined #ocaml
Herrchen has joined #ocaml
async has quit [Read error: 54 (Connection reset by peer)]
smkl has quit [brunner.freenode.net irc.freenode.net]
teratorn has quit [brunner.freenode.net irc.freenode.net]
blueshoe has quit [brunner.freenode.net irc.freenode.net]
srv has quit [brunner.freenode.net irc.freenode.net]
ayrnieu has quit [brunner.freenode.net irc.freenode.net]
yella has quit [brunner.freenode.net irc.freenode.net]
Riastradh has quit [brunner.freenode.net irc.freenode.net]
drWorm has quit [brunner.freenode.net irc.freenode.net]
mw has quit [brunner.freenode.net irc.freenode.net]
mattam has quit [brunner.freenode.net irc.freenode.net]
teratorn has joined #ocaml
blueshoe has joined #ocaml
drWorm has joined #ocaml
srv has joined #ocaml
mattam has joined #ocaml
yella has joined #ocaml
ayrnieu has joined #ocaml
Riastradh has joined #ocaml
mw has joined #ocaml
smkl has joined #ocaml
<blueshoe> i have no hub yet i must scream
det has quit ["Death to all fanatics!"]
<Maddas> heh
det has joined #ocaml
Kinners has left #ocaml []
<blueshoe> who is programming ocaml right this moment?
<Maddas> I'm leaving, later :)
<blueshoe> you're no fun!
<Maddas> blame my university :)
gim_ has joined #ocaml
<blueshoe> bad university!
<blueshoe> no diploma
* wuuru is eating fried potatoes right this moment
mimosa has joined #ocaml
<blueshoe> i'm doing some ocaml exercises
<blueshoe> to make up for all you SLACKERS!
<blueshoe> :)
<blueshoe> too bad ocaml doesn't have a single character comment, like perl's #
<mimosa> this is a recurrent troll on the caml-ml...
<blueshoe> heh... really?
<mimosa> yes
<mimosa> I remember of a very long thread about that
<blueshoe> well, they're right, dammit! :)
<mimosa> hehe
<blueshoe> actually, i don't see why you can't just have both types, just to give people the choice
<blueshoe> sometimes a closing and opening comment string is helpful, as when commenting out long blocks of code
<mimosa> the conclusion of the thread was, I think, to have shortcuts in emacs or vi
<blueshoe> but it should be easy to comment out something with a single #
<mimosa> but I agree with you
<blueshoe> yeah, there are shortcuts, but they're still not as easy as a single #
<blueshoe> you'd have to hilight the whole section you want to comment out
<blueshoe> which is a pain
<blueshoe> not something i'd abandon a language for, though :)
<blueshoe> now those damn error messages, that's another story
<blueshoe> "Parse error: [implem] expected after [str_item_semi] (in [implem])"
<blueshoe> now how the hell am i supposed to know this means that i need a "function" or a "|" ?
<blueshoe> at least it says where, though
<Smerdyakov> blueshoe, well, you can know if you look at the parser sources. :)
<blueshoe> yes, i was just about to do that
<blueshoe> i love digging through parser sources to figure out what error messages mean :)
<blueshoe> not that i paid a lot of money for ocaml or anything... i really shouldn't complain
<blueshoe> they've done a maaaavelous job... esp compared to most langs out there
<blueshoe> if i can't understand why my code is buggy it's my own fault :)
<teratorn> heh
Swynn_hm_afk is now known as Swynn_hm
<blueshoe> heh, that's interesting.. the syntax for "as" in ocaml is exactly the opposite of sml
<blueshoe> confusing when you're trying to learn one using a book on the other :)
<blueshoe> the "as" difference isn't listed onthe sml vs ocaml page either
mattam_ has joined #ocaml
<blueshoe> how do i convert a character to a string? there's no string_of_char
<blueshoe> there is a difference between 'a' and "a", isn't there?
<mattam_> String.make 1 'a'
<mattam_> sure there is a difference
<blueshoe> ahh, cool
mattam has quit [Read error: 110 (Connection timed out)]
<blueshoe> i looked in the string module, i guess not carefully enough
mattam_ is now known as mattam
<blueshoe> thanks, mattam
<mattam> np
blueshoe has quit [Read error: 104 (Connection reset by peer)]
det has quit [Read error: 104 (Connection reset by peer)]
det has joined #ocaml
blueshoe has joined #ocaml
karryall has joined #ocaml
_JusSx_ has joined #ocaml
<_JusSx_> wuuru : heya
<wuuru> _JusSx_: :-)
blueshoe has quit [Read error: 104 (Connection reset by peer)]
__mattam__ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
blueshoe has joined #ocaml
__DL__ has joined #ocaml
__DL__ has quit [Client Quit]
Swynn_hm is now known as Swynn_hm_afk
wazze has joined #ocaml
gim has quit [Read error: 54 (Connection reset by peer)]
Kinners has joined #ocaml
gim has joined #ocaml
__mattam__ is now known as mattam
gim has quit [Read error: 54 (Connection reset by peer)]
mattam_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
Kinners has left #ocaml []
blueshoe has quit [Read error: 104 (Connection reset by peer)]
gim has joined #ocaml
blueshoe has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
mattam_ is now known as matta
matta is now known as mattam
async has joined #ocaml
_JusSx_ has quit [Read error: 60 (Operation timed out)]
Defcon7 has quit [Remote closed the connection]
Defcon7 has joined #ocaml
blueshoe has joined #ocaml
_JusSx_ has joined #ocaml
_JusSx_ has quit ["[BX] Time to make the donuts"]
_JusSx_ has joined #ocaml
Demitar has quit [Remote closed the connection]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
kruskal has joined #ocaml
malc has joined #ocaml
blueshoe has joined #ocaml
Smerdyakov has quit [Read error: 60 (Operation timed out)]
kruskal has left #ocaml []
Smerdyakov has joined #ocaml
Smerdyakov has quit [Read error: 60 (Operation timed out)]
Smerdyakov has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
__DL__ has joined #ocaml
malc has quit ["no reason"]
karryall has quit [Ping timeout: 14400 seconds]
joe_ has joined #ocaml
<joe_> hi
<joe_> is there an equivalent of Haskells 'Maybe' monad in ocaml ?
<Smerdyakov> I don't think there's anything standard, but it's trivial to implement.
<joe_> k, I didn't want to implement if there was a standard way
<joe_> thx
<joe_> another question ... is there a shorthand way of doing a match on the args to a function ?
<smkl> joe_: function, but it only matches one arg
<joe_> k, thx
joe_ is now known as ejt
Nutssh has joined #ocaml
Nutssh has quit ["Client exiting"]
blueshoe has joined #ocaml
<ejt> so do people normally use exceptions instead of Maybe ?
blueshoe has quit [Read error: 104 (Connection reset by peer)]
<Smerdyakov> Yes
* ejt wonders if exceptions are more imperative than functional
<ejt> I suppose they're a type of continuation
<__DL__> ejt : yes, well, it is simulable with continuation
Swynn_wk_afk is now known as Swynn_wk
<Swynn_wk> OMG ... I wrote some code to mess around with arrays in ocaml (found it hard going and I can't get it to do all that I want yet), and it took 6 secs to run compiled with ocamlc (and interactive took 6 secs as well). I then wrote the same code in perl (which was quite easy for me) but it took 16 secs to run. I then compled the ocaml code again but this time with ocamlopt <-- now the code runs in 0.6 secs!!!
<Maddas> Perl is
<Maddas> very slow for number crunching
<Swynn_wk> yup
<Swynn_wk> but not bad with text?
<Maddas> well, it's very easy to do text manipulating
<Maddas> and I guess the speed difference isn't *that* big
<teratorn> perl is fast enough for the majority of programming tasks done today (and many other fine interpreted languages too)
<Swynn_wk> I just can't believe how fast ocamlopt is!!!!!!!!
<teratorn> optimize last, etc :)
<Maddas> teratorn: it's perticularily bad at number crunching though, just wanted to point that out to Swynn_wk :)
<teratorn> Swynn_wk: ocaml is indeed pretty fast natively compiled, very much in the same leauge as C
<Maddas> yeah
<Swynn_wk> ahhh yes ... perl uses floating point even for integers
<Riastradh> Perl is designed _for_ manipulating text.
<teratorn> Swynn_wk: nah
<Maddas> Riastradh: Indeed
<teratorn> Swynn_wk: that would be practically impossible
Nutssh has joined #ocaml
<Swynn_wk> teratorn, my perl book says "But internally, Perl computes only with double-precision floating-point values.[2] This means that there are no integer values internal to Perl"
<ejt> that surprises me
<Swynn_wk> an integer constant in the program is treated as the equivalent floating-point value.[3]
<Swynn_wk> "[2] A "double-precision floating-point value" is whatever the C compiler that compiled Perl used for a double declaration."
<Swynn_wk> "[3] Unless you use "integer mode," but that's not on by default."
<Swynn_wk> sry for the spam
<teratorn> hrm!
<teratorn> anyone reason not to use perl
<Maddas> heh
<teratorn> that's just nutty
<Nutssh> Heh. Not well typed, you can add a 3.14159 and a string. :)
<Maddas> teratorn: certainly not for maths, as I already mentioned :)
<teratorn> weakly, dynamically typed == teh suk
<Swynn_wk> well, you can see why I'm struggling to learn ocaml's concepts :P
<Maddas> teratorn: I doubt it
<teratorn> Maddas: what?
<Maddas> teratorn: what you said last before what I said
<Nutssh> I do sorta like lisp though. With CMUCL its not per-se untyped, the compiler performs type inference and warns of any 'funny things' going on.
<teratorn> you think a weakly and dynamically typed lange is good?
<Maddas> teratorn: be more precise
<teratorn> that is precise.
<Maddas> teratorn: I know many statically typed languages that are really pretty useless
<Maddas> no, it is not
<Maddas> A language is not characterised by "weakly and dynamically typed"
<Swynn_wk> no ... he said "= tex sux" which means it's bad
<teratorn> that is one thing it can be characterized by
<Maddas> and speaking so generally is not representative, the type system alone doesn't automatically make it good/bad
<Maddas> yes, but it's not the only deciding factor
<Nutssh> teratorn, I think I'd characterize perl as weakly typed, but lisp as strongly typed, but both are dynamically typed.
<teratorn> perl is weakly, dynamically typed. python is strongly, dynamically typed.
<Maddas> So?
<Maddas> There are many weakly, dynamically type languages
<teratorn> like php
<Maddas> I doubt they all fall under the same category just because of this
<Maddas> well, ok, maybe not *that* many
<teratorn> also teh sux
<Maddas> Never mind.
<teratorn> Maddas: well name one!
<Swynn_wk> so I've worked out that ocamlopt is 23 times as fast as perl, and 3500 times as fast as Microsoft Excel macros :PP
<Nutssh> I do think it is annoying to have to put in endless type declarations a-la-Java. One reason I don't mind strong typing in ocaml, almost no type declarations.
<teratorn> i'm curious now!
<Smerdyakov> teratorn, Tcl?
<teratorn> Swynn_wm: heheh
<Maddas> teratorn: No.
<teratorn> Smerdyakov: is it now? well i can't really comment on tcl.
<teratorn> Smerdyakov: can you?
<Smerdyakov> I can't.
<Nutssh> TCL is great, before 8.0, it was possible to construct *and use* ill-formed syntatic entities..
<Maddas> Nutssh: oh yes, and "everything is a string" is just plain awesome :-)
<Nutssh> It stored everything as a string. A list was a string deliminated by '{' '}' (with escaping of characters that would make it ill-formed).
<Nutssh> It would let you index a string without the closing delimiter.
<teratorn> ok, i think i've heard enough :)
<Maddas> Nutssh: It's just tolerant! :)
<Nutssh> LOL.
<Nutssh> Or, the ability to do command-execution in command names foo[eval "1+23+$bar"]huh arg arg arg
<Nutssh> Swynn_wk: what are you doing?
<Swynn_wk> my code? .. I'm just making arrays with random numbers and working out the difference etc ...
<Swynn_wk> I have a goal to do this in ocaml: http://www.generation5.org/content/2003/gahelloworld.asp
<Nutssh> Cool.
<Nutssh> How does ocamlc compare to perl?
<Swynn_wk> speed you mean?
<Nutssh> *nod*
<Nutssh> Its probably a fairer comparsison.
<Swynn_wk> compled with ocamlc the code took 6 secs to run, and perl took 16 secs to run
<Swynn_wk> but I probably haven't written the ocaml code very well, it was a bit of a hack to get it going (as I don't know what I'm doing yet )
<teratorn> Swynn_wk: can you paste? how many lines of perl?
<Swynn_wk> 63 lines of perl ..39 of ocaml ...
<Swynn_wk> whats one of the webpages I can post on again?
<teratorn> pastebin.com works
<ejt> the GA may take fewer generations if the probability of breeding is proportional to the fitness score, rather than just breeding uniformly from the top half
<Maddas> uhm
<Swynn_wk> ejt .. I agree, I don't know how they did it on that site tho ... have looked at the c code as I don't know c
<Maddas> Swynn_wk: mind if I rewrite your Perl code?
<teratorn> heh
<ejt> have you got your ocaml code ?
<Swynn_wk> Maddas, I would be very glad if you did!
<Maddas> well, refactor a bit at least :)
<Swynn_wk> http://pastebin.com/34425 is the ocaml code (don't laugh tho!!)
<Swynn_wk> ejt ... sry I'm taking long ... damn work keeps getting in the way :P
<Swynn_wk> Note: my code only uses random attempts ... it doesn't use any optimizing techniques at all yet (it's good to do random first and then compare it with an optimized technique etc)
<Swynn_wk> so you can see that it's take years and it still wouldn't get very far!
<Swynn_wk> (the way it is at the moment)
<Swynn_wk> (appologies if what I've typed really belongs in #ai ... just trying to give you a background of my code etc)
<mimosa> hi Swynn_wk
<ejt> I'm learning ocaml myself, so won't comment on the code, other than grimacing at the for loops ;)
<Nutssh> It resembles C code, not functional code.
<Maddas> true
<Maddas> Out of interest, you don't usually count empty lines when counting LOC, do you?
<Swynn_wk> hi mimosa :)
<Swynn_wk> LOC?
<Swynn_wk> what is that?
<Maddas> Lines Of Code
<Swynn_wk> oh ...
<Maddas> :)
<ejt> does ocaml have an equivalent of 'flip' ?
<Swynn_wk> yea .. I just did a "wc -l" in linux so yea it counts the empty lines :/
<Maddas> ejt: as in reverse an array?
<ejt> as in : let flip f a b = f b a
<Maddas> ejt: there you have it
<Maddas> :)
<Swynn_wk> ejt, about my loops, I was thinking that I'd get it working with loops 1st, and *then* change it to recursion (so I can learn)
<ejt> Swynn_wk: take no notice of me, I'm being a FP bore ATM
<Swynn_wk> FP?
<ejt> functional programming
<Swynn_wk> oh ... yea
<Swynn_wk> but any suggestions / critics / telling's off / etc about my code I wont be offended :)
<Nutssh> Here's something that may interest ya...
<Nutssh> let fitness trial =
<Nutssh> let fn i accum = accum+ (abs (trial.(i) - target.(i)))
<Nutssh> in Array.fold_left fn trial;;
<ejt> Swynn_wk: too many magic numbers
mimosa has quit ["J'ai fini"]
<Nutssh> Oh, bleah, I suck. Nevermind that.
<Maddas> heh Nutssh
<Nutssh> I want Array.fold_left2
<Maddas> Wouldn't that be the same as abs (sum trial - sum target)?
<Nutssh> Actually, I want String.fold_left2
<Maddas> where sum = Array.fold_left (+) 0
<Maddas> Or am I just being stupid?
<Nutssh> No. Note that I dereference the variable i.
<Nutssh> But yeah, sum = Array.fold_left (*) 0 is right.
<Maddas> Yes, I am aware of that
<Maddas> But why isn't it the same?
<Maddas> oh, the abs()
<Maddas> never mind, I'm being stupid
<Nutssh> Join the club. :)
<Maddas> heh :)
<Maddas> (seems like an unlikely meeting place)
<Nutssh> Lol.
<Nutssh> BRB.
<Nutssh> Back.
ejt has quit ["sleep"]
<Riastradh> You want natural_fold: let natural_fold kons knil k = let rec loop knil = function k' when k' = k -> knil | k' -> loop (kons k' knil) (k' + 1) in loop knil 0
<Riastradh> natural_fold (fun k s -> s + (abs (tab1.(k) - tab2.(k)))) 0 (Array.length tab1)
<Nutssh> Ah, Purty. Thanks. :)
__DL__ has quit ["late at night : going to bed"]
<Riastradh> Array.fold_left & Array.fold_right are pretty useless in the presence of natural_fold_left & natural_fold_right.
<Nutssh> Well, they can be defined in terms of em.
<Riastradh> That too.
* Swynn_wk takes notes
gim_ has quit [Read error: 110 (Connection timed out)]
<Nutssh> Good primitive for the first part of computing strings. That plus array.iter should remove most explicit loops that do anything other than straight assignment.
<Riastradh> Array.iter is not necessary in the presence of the folding operations (the difference is three characters: SPC, '(', and ')'), and the folding operations are useless in the presence of the integer folding operations.
<Nutssh> True, but I think it is important for semantics. Fold for when you expect a result, iter for when you want side-effects. One reason I always try to make functions that are side-effect only always return unit.
<Swynn_wk> when I try and print "bestfitness" with print_int it doesn't work, as bestfitness is a ref, but print_int(!bestfitness) doesn't work either ... ok here's the plan, I'm read http://www.cs.caltech.edu/courses/cs134/cs134b/book.pd at home, and then go from there :)
<Maddas> print_int !bestfitness
<Swynn_wk> I did print_int(!bestfitness) ... is that wrong?
<Nutssh> I can't offer much help with how-to-learn ocaml. I already know SML-NJ before I learned ocaml.
<Swynn_wk> no worries .. I must read :)
<Riastradh> Swynn_wk, what do you mean 'print_int (!bestfitness)' doesn't work either?
<Swynn_wk> I mean, I tried 'print_int (bestfitness)' and 'print_int (!bestfitness)' but both gave an error
<Nutssh> What is the type of bestfitness?
<Nutssh> It should be 'int ref'. (Also, did you check for extra/missing ';'?)
<Swynn_wk> let bestfitness = ref fitness;;
<Riastradh> Swynn_wk, what's the error that 'print_int (!bestfitness)' gives?
<Nutssh> And what type is fitness?
<Swynn_wk> hang on ...
<Nutssh> (If I remember right from the file, fitness is a functioon, not an integer?)
<Swynn_wk> yes
<Swynn_wk> val fitness : int ref = {contents = 554}
<Swynn_wk> val bestfitness : int ref ref = {contents = {contents = 554}}
<Swynn_wk> but when I do 'print_int(!bestfitness);' inside the for loop, I get this error: This expression has type int ref but is here used with type int
<Nutssh> So either bestfitness should be !fitness, or you need to do print_int !!bestfitness.
<Swynn_wk> ohhhhhhhhhhh
<Swynn_wk> Unbound value !!
<Nutssh> *grin* The type error tells you what the problem is.. Usually you go 'doh' and thats it.
<Nutssh> Try '! ! .....'
<Swynn_wk> it works!!!!!!!!!!!!!!!!!
<Nutssh> Heh. :) But are you sure you want int ref ref, not int ref?
<Swynn_wk> .... um
<Riastradh> You probably did something like:
<Riastradh> let bestfitness = ref fitness
<Swynn_wk> I should have used !fitness I think ... as you said
<Riastradh> and you probably meant to do something like:
<Riastradh> let bestfitness = ref !fitness
<Riastradh> to copy fitness.
<Swynn_wk> yes Riastradh exactly!
<Swynn_wk> well, that was a good lesson for me :)
<Riastradh> Or you needn't even bind bestfitness at all; substitute fitness for every use of bestfitness, or change 'ref !fitness' to 'sum_of_diffs ...'.
<Smerdyakov> Hm. I never realized OCaml ref's were equated with special record types.
blueshoe has joined #ocaml
<Riastradh> Smerdyakov, there's nothing that's particularly special about refs.
<Riastradh> type 'a ref = { contents : 'a }
<Riastradh> Er.
<Smerdyakov> In OCaml, there isn't.
<Smerdyakov> In SML, there is.
<Riastradh> type 'a ref = { mutable contents : 'a }
<Nutssh> Heh.. In SML, tuples are really immutable records with keys of '1,2,3,4, ...'
<Nutssh> Hey, while you're here, I've got a question. Is there any way too have an open record type without going to classes?
<Smerdyakov> "open"?
<Nutssh> What I want is I want a function that accepts as an argument *any* record defining, say, three variables,
<Smerdyakov> I don't follow.
<Swynn_wk> Once again people, I'm impressed by the friendlyness of this channel ... gtg and do some work ... but thx heaps for all your help!
<Smerdyakov> Records don't "define variables."
<Nutssh> Define bindings of the labels in the record.
<Riastradh> Nutssh, you're asking the wrong question, but no.
<Smerdyakov> Can you just say in words the exact semantics of such a function?
<Smerdyakov> Or use made-up OCaml like synatx?
<Smerdyakov> synatx
<Nutssh> Here's roughly what I mean. I vaguely recall that you can do this with SML-NJ records?
<Smerdyakov> syntax
<Nutssh> type FooBuf.t = {buf: string; mutable index : int ; something }
<Nutssh> type BarBuf.t = {buf: string; mutable index : int ; something_else }
<Nutssh> val doMatch {buf: string ; mutable index : int; ; ...} -> int
<Smerdyakov> But each record fields name is associated with a particular record type in OCaml.
wazze has quit ["If we don't believe in freedom of expression for people we despise, we don't believe in it at all -- Noam Chomsky"]
<Smerdyakov> So what you're asking doesn't make sense.
<Nutssh> The function doMatch accepts an open type that either FooBuf.t or BarBuf.t match.
<Riastradh> Nutssh, Smerdyakov is pedantically telling you that OCaml doesn't support this.
<Nutssh> Yeah, I know. Module elaboration will expand the label 'buf' into 'Foobuf.buf' or 'BarBuf.buf'.
<Smerdyakov> Not possible. The inclusion of a single record field uniquely determines the record type.
<Smerdyakov> Riastradh, not pedantically...
<Nutssh> Pretty much what I thought from my reading of the semantics. :(
<Nutssh> So if I want to do this very efficiently, without gratitious copy&paste of doMatch into module FooBuf and module BarBuf, what are my choices?
<Smerdyakov> Functorize?
<Riastradh> Nutssh, use selector procedures instead of record labels.
<Nutssh> Use classes (how efficient are they? I've not yet used them). Or, encapsulate the into a new object Buf.t that is included in BarBuf.t/FooBuf.t
teratorn has quit ["Terminated with extreme prejudice - dircproxy 1.0.5"]
teratorn has joined #ocaml
<Smerdyakov> I think I would functorize doMatch.
<Nutssh> Riastradh: What I thought... Oh no. :) I was sorta hoping to half-pretend that classes don't exist, they seem messy.
<Riastradh> Yes, OCaml's object system sucks.
teratorn has left #ocaml []
teratorn has joined #ocaml
<Smerdyakov> Untrue. OCaml's object system is very nice.
<Nutssh> Smerdyakov: Tried that, doesn't work because BUFTYPE has to expose t in functor Foo(Buf : BUFTYPE)
<Smerdyakov> Nutssh, what's wrong with that?
<Riastradh> Nutssh, you can pretend classes don't exist. Selector procedures don't have anything to do with classes.
<Nutssh> Smerdyakov: Or at least it doesn't seem to work...
<teratorn> Smerdyakov: not really
<teratorn> it's usable, but it's not "nice"
_JusSx_ has quit [Read error: 110 (Connection timed out)]
<teratorn> due to the fact that it's an add-on so to speak
<Smerdyakov> teratorn, for my uses, it qualifies as very nice.
<Smerdyakov> teratorn, I only ever want objects as an add-on, anyway.
<teratorn> Smerdyakov: heh
<teratorn> Smerdyakov: well for example
<Nutssh> Riastradh: What are selector procedures? ( And my complaint is that their semantics seems confusing and a bit grotty. I'm sure they're very useful for this sort of stuff)
<Smerdyakov> Nutssh, I don't understand your problem with functors.
<Riastradh> Nutssh:
<teratorn> you use Lisp.map instead of a map method on the list
<Riastradh> type foo = { buf : buftype }
<Riastradh> let foo_buf foo = foo.buf
<teratorn> it's just kind of silly
<teratorn> works just the same though
<Riastradh> Smerdyakov, as an object system, compared to, for instance, CLOS, it's terrible; for generic dispatch, as compared to typeclasses, it sucks.
<Smerdyakov> teratorn, you are saying OCaml OO is bad because list values don't have methods?
<teratorn> uhh
<teratorn> when did i say it was bad?
<Smerdyakov> Riastradh, I've never had a major problem with it....
<Smerdyakov> <teratorn> it's usable, but it's not "nice"
<Riastradh> Smerdyakov, have you ever used CLOS?
<teratorn> Smerdyakov: yeah...?
<Smerdyakov> teratorn, and then you proceded to say something about the object system.
<teratorn> yeah...?
<Smerdyakov> teratorn, I think it's reasonable to assume you were justifying your assertion.
<teratorn> yeah...?
<Nutssh> Smerdyakov: If BUFTYPE hides type t, then Foo cannot use the labels to extract fields from t. If it exposes type t, then only one of FooBuf.t or BarBuf.t can match the signature.
<Smerdyakov> teratorn, so, there are two possibilities:
<Smerdyakov> teratorn, you think that fact that list values are not objects prevents OCaml OO from being "nice."
<Smerdyakov> teratorn, or you violated a conversational maxim. :)
<teratorn> ahem
<Smerdyakov> Riastradh, no.
<teratorn> <teratorn> when did i say it was bad?
<Smerdyakov> Pretend I said "not 'nice'" instead of "bad."
<Riastradh> Smerdyakov, what object systems besides that of OCaml have you used?
<Nutssh> Riastradh:
<teratorn> see, it only took one line instead of 7 :)
<Nutssh> # type foo = {buf : int};;
<Nutssh> type foo = { buf : int; }
<Nutssh> # let foo_bar = foo.buf;;
<Nutssh> Unbound value foo
<Smerdyakov> Riastradh, I'm not going to discuss this. I very rarely want an "object system," and OCaml's does EVERYTHING I want in those cases.
<Smerdyakov> teratorn, what?
<Riastradh> Nutssh:
<Riastradh> # type foo = { buf : int };;
<Riastradh> type foo = { buf : int; }
<Riastradh> # let foo_buf foo = foo.buf;;
<Riastradh> val foo_buf : foo -> int = <fun>
<teratorn> Smerdyakov: ...that's all you had to say...instead you rambled for 7 lines about i dunno what.
<Riastradh> You misread what I wrote.
<Smerdyakov> teratorn, no, we had a communication problem where I understood "bad" as equivalent to "not nice" and you didn't.
<Riastradh> Smerdyakov, just answer my question.
<teratorn> Smerdyakov: and when i called you on it, all you had to do was acknowledge it.
<Nutssh> Ah. I see. Essentially a notion of accessor functions. Expose them in the BUFTYPE signature and hide t.
<teratorn> anyway! let us not waste further time.
<Smerdyakov> Riastradh, I think.... Java, C++, ... maybe that's it.
<ayrnieu> Smerdy - I'd say 'holds a negative value of niceness'
<Nutssh> Riastradh: Think I should use that mechanism, or classes?
<Smerdyakov> teratorn, I don't agree that it is a "mistake" I made. It is a difference in assumptions between us, and no one was "at fault."
<Riastradh> Smerdyakov, OK, so you really can't compare OCaml's object system, can you?
<ayrnieu> Smerdy - should you ever use Smalltalk or Ruby or CLOS, you may find yourself more amicable to OO in those languages.
<Smerdyakov> Riastradh, who cares..?
<teratorn> Smerdyakov: that's not the point.
<Nutssh> Riastradh: And thanks!
<Smerdyakov> teratorn, well, I think it is the point, given the tone you've been taking with me.
<ayrnieu> Smerdy - probably still not O'Caml =) but I don't understand where this argument has come from.
<Riastradh> Smerdyakov, if no one cares, then why did you make a comment about OCaml's object system?
<teratorn> Smerdyakov: I Didn't say you were at fault for assuming i meant it was bad!
<Smerdyakov> Riastradh, I said it satisfies my requirements quite nicely.
<Smerdyakov> teratorn, your use of the phrase "called you on it" implies that.
<Riastradh> Smerdyakov, and that comment is irrelevant if no one cares about how well you can compare object systems.
<teratorn> Smerdyakov: i'm annoyed your wasting my time when all wanted you to do was acknowledge i didn't say it was bad.
<teratorn> s/all/all I/
<ayrnieu> Riastradh - you seem to have introduced the subject with "Indeed, OCaml's object system sucks."
<Smerdyakov> teratorn, but you DID say it was bad, under my reasonable assumptions, where "not nice" = "bad".
<teratorn> Smerdyakov: hahahaha
<teratorn> ok i'm done
<ayrnieu> teratorn - you negated Smerdyakov's "Untrue. OCaml's OO is very nice" with "not really"
<Riastradh> ayrnieu, I am not Smerdyakov, so my whole point about his comment being irrelevant does not apply.
<Smerdyakov> Riastradh, really? It's not relevant that a particular person achieves a particular development effectiveness using a particular language?
<teratorn> ayrnieu: sure
<Riastradh> Smerdyakov, that's not the bloody point.
<Nutssh> I found it difficult to understand, especially the later examples in the documentation. A tool where its hard to tell if something will be well-typed is stressful to use. I don't want to spend 3 days, then find out that the object system cannot express the semantics I was hoping.
<Riastradh> The point is that as an object system it sucks and as a generic dispatch system it sucks. As an object system, you have nothing to compare it to. As a generic dispatch system, you have conceded in the past that typeclasses are better.
<ayrnieu> teratorn - given this, I don't think him too insane for reading that as an assertion of the not-niceness of O'Caml's OO system -- but I can see how you may have meant that in a small-positive rather than negative way =)
<Smerdyakov> I never claimed to be comparing it to anything.
<Smerdyakov> I have some requirements that an object system can fill, and OCaml fills them.
<teratorn> ayrnieu: as i said, i don't think he was at fault for, at first, coming to that conclusion.
<Smerdyakov> That qualifies it as being very nice, independently of anything else that ever existed.
<Nutssh> Sorry for accidently starting the flamefests.. One last question. How inefficient the object system?
<Riastradh> Smerdyakov, oh, so nicety is absolute?
<ayrnieu> Nutssh - you apologize for starting a 'flamefest' and then you ask a biased question like that? Or did someone already introduce the object system's inefficiency?
<Smerdyakov> The development efficiency rate tools allow me to reach is absolute, yes.
<teratorn> ayrnieu: however, when i said "when did i say it was bad?", that would indicate that, in fact, i did not mean that. then it's just a simple matter of saying acknowledging that.
<Riastradh> ayrnieu, um, he asked a pretty objective question.
<teratorn> s/saying//
<teratorn> anyway, this is bloodly getting ridiculous
<Riastradh> teratorn, thank Smerdyakov for that!
<ayrnieu> Riastradh - I don't know what you mean when you say 'objective'. Unless someone introduced the object system's inefficiency, he shouldn't ask 'how inefficient' questions.
<Riastradh> Smerdyakov, if you knew better, do you suppose you could develop faster?
<Smerdyakov> In English, "inefficient" has much different connotations from "efficient."
<Riastradh> 'Inefficient' is the negation of 'efficient.'
<ayrnieu> Smerdy - what Riastradh said.
<Smerdyakov> Riastradh, I doubt any significant difference would arise.
<Nutssh> I face a question of how to implement some buffering stuff in the future. Given no open types (my first choice), its either a minor functor-purgatory, or the object system of which i've read the docs but not used.
<Smerdyakov> Riastradh, ayrnieu, this is not what linguistics tells us.
<teratorn> "efficient" and "inefficient" are both highly context dependent.
<ayrnieu> Smerdy - questions like "So, how much do you suck at tennis?" and "How horrible does this poem of your daughter's strike you?" have similar problems.
<Smerdyakov> Opposites need not be symmetrical. It's a fact that English speakers interpret "efficiency" neutrally and "inefficiency" as suggesting a poor efficiency level.
<ayrnieu> Smerdy - I defer to my experience with the English language on that point.
<Riastradh> Smerdyakov, ah, you _doubt_. But if you don't know any better, how could you know?
* teratorn goes afk
<ayrnieu> Smerdy - it usually works like that, yes =)
<Nutssh> Oh for crying out loud... I can either do functors or object system. Which is going to be worse?
<Smerdyakov> ayrnieu, it always works like that.
<Riastradh> Nutssh, in terms of efficiency?
<Smerdyakov> ayrnieu, it's a property of real English today.
<ayrnieu> Nutssh - see, here you go again asking about worseness.
<ayrnieu> Nutssh - but I suppose that you don't natively speak English, then, so no worries.
<Riastradh> Nutssh, guess. Object systems do dynamic dispatch. Module name lookup is done statically.
<Nutssh> Fine, which is going to be better. :)
<ayrnieu> Nutssh - people generally advise that you use O'Caml's alternatives to its OO system.