goomba has quit [Read error: 104 (Connection reset by peer)]
Nutssh has joined #ocaml
Walnutssh has joined #ocaml
Nutssh has quit [Read error: 104 (Connection reset by peer)]
Walnutssh is now known as Nutssh
smkl_ has joined #ocaml
<vincenz>
GI
<vincenz>
HI
jeff2 has quit [Read error: 60 (Operation timed out)]
cognominal has quit [Read error: 60 (Operation timed out)]
__DL__ has quit ["Bye Bye"]
swaplinker has quit [Read error: 54 (Connection reset by peer)]
goomba has joined #ocaml
smkl_ has quit [Read error: 60 (Operation timed out)]
fab_ has joined #ocaml
_fab has quit [Read error: 110 (Connection timed out)]
smkl_ has joined #ocaml
Skal has quit ["Client exiting"]
cjohnson has quit [Read error: 54 (Connection reset by peer)]
grirgz has quit [Read error: 110 (Connection timed out)]
mattam has quit [Read error: 110 (Connection timed out)]
smkl_ has quit [Read error: 110 (Connection timed out)]
monochrom has quit ["Few people understand understanding."]
Herrchen has joined #ocaml
smkl_ has joined #ocaml
juhammed has quit [Read error: 110 (Connection timed out)]
Herrchen_ has quit [Read error: 110 (Connection timed out)]
Submarine has joined #ocaml
vezenchio has joined #ocaml
smkl_ has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
smkl_ has joined #ocaml
<Snark>
slt
<Snark>
why does ocamlmklib name the lib dllname.so !?
<Snark>
I mean, I was having linking problems... did a ln -s dllname.so libname.so, and voila!
skylan has joined #ocaml
<Snark>
oohhh... there's a libname.a that helps...
<Snark>
and it avoids to have a dependancy on the stub code...
<Snark>
wonderful!
smkl_ has quit [Read error: 110 (Connection timed out)]
<vincenz>
I wish ocaml had typeclasses
<mrvn_>
what do you mean?
<vincenz>
typeclasses
<vincenz>
ala haskell
<mrvn_>
what do you mean?
<vincenz>
...
<vincenz>
your record is broken
<mrvn_>
I don't know haskel past hello world so that doesn't help.
<vincenz>
type classes means you have classes of types
<vincenz>
and you can define operations on them
<vincenz>
like +
<vincenz>
it could be defined for floats and ints
<mrvn_>
polymorphism basically
<vincenz>
not quite
<vincenz>
restrained polymorphism
<mrvn_>
The problem is that you need either code duplication or runtime type information for that.
<pango>
what gcaml does, from what I understand
<mrvn_>
It would be slower and use more ram
<vincenz>
oh
<vincenz>
well basically the = operator does it
<vincenz>
albeit it in a non orthogonal fashion
<mrvn_>
= compares the bit patterns so no type handling required there.
<mrvn_>
It's probably inlined too.
<vincenz>
another nice thing are their functors
<mrvn_>
at least only GC infos, not full types
<mrvn_>
You can use `Int in ocaml for polymorphism.
Herrchen has quit ["bye"]
tintin has joined #ocaml
tintin has left #ocaml []
Snark has quit [Read error: 60 (Operation timed out)]
Snark has joined #ocaml
Hadaka has quit [Read error: 110 (Connection timed out)]
pango has quit [Remote closed the connection]
__DL__ has joined #ocaml
_JusSx_ has joined #ocaml
<mflux>
mrvn_, how would it do any of that, except in the cases when the polymorphism actually gets you something 'new'?
<mflux>
that is, how does it matter if the operation of adding two floats is called +. or +
<mflux>
of course, you could write more generic functions, which would be slower or bloater than their counterparts
<mflux>
but code such as let sum (a : float list) = List.fold_left ( fun a b -> a + b ) 0.0 a should not have any impact on size of performance
<vincenz>
aawoo
<Snark>
notice that eiffel does polymorphism and strong compile-time checking... but with still a little run-time overhead
<mrvn_>
mflux: let foo a b = a + b
<mrvn_>
What type does this have?
<mflux>
mrvn_, obviously it depends on the input arguments
<mflux>
mrvn_, but earlier you needed to do foo_int and foo_double manually
<mflux>
is that betteter?
<mflux>
..or 'better'
<mrvn_>
fun 'a of (int|float) -> 'a of (int|float) -> 'a of (int|float)
<mrvn_>
Something like that.
<mflux>
well that isn't quite exactly it I would say
<mflux>
I wonder how gocaml displays those
<mflux>
oh wait, you used 'a, never mind ;)
<vincenz>
haskell uses restrictions
<mrvn_>
a, b and the result are codependent. If one has a fixed type they all do.
<vincenz>
fun : (TypeClassHAvingPlus a) => a -> a -> a
<vincenz>
what mrvn_ said
<vincenz>
anyways: mrvn_ you don't need to know the type of foo until it's used
<mflux>
at compile time, when it would be called, the proper function could be generated or the generic one used
* vincenz
nods
<mrvn_>
TypeClassHAvingPlus would be a module or object in ocaml.
<vincenz>
I know there are a few limitations to what mflux said
<mflux>
if the code is generated, it's still just as much code let foo a b = a + b would be
<mflux>
if you use the float version too, then it's more, but you didn't have that version before either
<vincenz>
yip
<mflux>
something to tell the compiler what you want could be nice, at the moment you can tell about stuff on command line
<mrvn_>
The code has to be in the *.ml file. Say you export that function from a module.
<mflux>
that just means the compiler mechanism needs to be changed
<mrvn_>
*.mlx file
<mrvn_>
The problem is that the dependency of the types gets carried into the calling function.
<mrvn_>
From there on upwards through the calling structure.
<mrvn_>
You can probably easily find a case where that gets more complex exponentially with code size.
<vincenz>
mrvn_: either way right now the compiler isn't that grand... for instance it does no cross-module optimizations
<vincenz>
mrvn_: you can find cases where compiler gets exponential with code size for more htings, but usually they are atypical
<mrvn_>
vincenz: No compiler realy does. Thats what compilation units are for.
<vincenz>
mrvn_: there you are wrong
<vincenz>
anywho
<vincenz>
lablgtk or lablgtk2 or wxocaml?
<mrvn_>
vincenz: by the way, ocaml has the option to inline across modules somewhat.
<shrimpx>
the way typeclasses work is every function calling say, +, is turned from f x = ... + ... into f d x = ... (d +) ... where the right dictionary d containing the right implementation of + is passed at every call site
<shrimpx>
so changing ocaml to do that is quite involved i think =)
<mrvn_>
that would also be slow.
<shrimpx>
yea it's decent overhead... there are several optimizations that can be applied but still
<mrvn_>
You can do interfaces for this easily in ocaml. Just not with + - * /
<shrimpx>
but i duno i don't think the fact that + and +. are disparate is a big deal
<mrvn_>
I prefer it and I always forget.
<mflux>
I think it takes part of the advantages of type inference away
<shrimpx>
in haskell, for example, combining floating point and integer arithmetic in one expression can get ultra hairy
<mrvn_>
Can you wite int + float?
<shrimpx>
but i agree that having print_int, print_string, etc, is unfortunate
<mrvn_>
+r
<mflux>
great, so you don't need to tell the types of the variables you're adding, but still you need to use a certain operator telling just that
<shrimpx>
mrvn_: no
<mrvn_>
shrimpx: Printf.printf
<mflux>
well, I too think +. in particular isn't that bat, but others are
<shrimpx>
mrvn_: oh actually you can
<mflux>
but Printf.printf is implemented with some language built-in dark magic?
<mflux>
so, it's a kludge ;)
<shrimpx>
the whole print_string thing is silly because ML is supposed to do away with type annotations but those are the worst kind of type annotation
<mrvn_>
mflux: is does compile time string parsing.
<vincenz>
wow
<mrvn_>
mflux: You can do the same with CPS annotations and symbols.
<vincenz>
this lablgtk2 is cleaner than I thought
<mflux>
mrvn_, yes, and what if you wanted to extend that or make another kind of syntax
<vincenz>
I had experiences with tk before and it was UGLY
<mflux>
mrvn_, hm?
<mrvn_>
mflux: then you cp printf.ml and edit.
<mrvn_>
mflux: I have a a I/O module that does non-blocking I/O on unix FDs with CPS annotation. Same for input and output.
<mflux>
and CPS annotation is.. ?
<mflux>
;)
<mrvn_>
write (Int8 $ Int8 $ UInt16 $ String 16)
<mrvn_>
fun int -> int -> int -> string -> unit
<mrvn_>
CPS == continuation apssing style.
<mrvn_>
s/ap/pa/
* shrimpx
doesn't get it
<mflux>
I infact asked a related question some time ago here, nobody reacted to it though
<mrvn_>
The $, Int8, UInt8, ... are CPS style so you can mangle them together.
<mflux>
I was trying to something like (foo "?0, ?2, ?1" +% (0, Int) +% (1, Str) +% (2, Float)) 42 "foo" 4.2 to work
<mrvn_>
printf with positional arguments?
<mflux>
yes
<mrvn_>
doesn't printf have that already?
<mflux>
hm, no?
<mrvn_>
read stdlib/printf.ml
<mflux>
anyway the application would be generating sql statements
<mflux>
so strings would need to be quoted in database-style automatically
<mflux>
I'll take a look at it, it isn't that long though
<mrvn_>
I never tried but it shouldn't be to hard to copy printf and modify it to do the quoting.
Naked has joined #ocaml
Naked is now known as Hadaka
pango has joined #ocaml
smimou has joined #ocaml
<vincenz>
Anyone work with lablgtk2?
<Snark>
vincenz: I'm using it
<vincenz>
well I have a small issue with it
<vincenz>
my pointer always looks like a clock
<Snark>
uh?
<vincenz>
my cursor
<vincenz>
it always look like a clock
<Snark>
you mean your mouse cursor
<vincenz>
yes
<Snark>
you must have done something to it, because I never saw it change by itself
<vincenz>
nope
<vincenz>
also...I'm getting type errors on the gtree example