dylan changed the topic of #ocaml to: OCaml 3.09.1 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
<tspier2> asymptote, are you very good with OCaml?
<asymptote> no
<asymptote> but I can try
<tspier2> What function do I use to read a line of text from a file?
<asymptote> there's a few...
<asymptote> do you have a descriptor or a stream?
<tspier2> Well, say I have a file, and each line has "x, y", however different values are placed in x and y. How can I make those two values be read in, so then I can use them in that equation?
<asymptote> well, Unix.read is kind of the big one
asymptote has quit ["Leaving"]
<tspier2> Hmm, that didn't help.
<tspier2> pango
<tspier2> Anyone conscious?
Submarine has quit [Read error: 104 (Connection reset by peer)]
dark_light has joined #ocaml
Submarine has joined #ocaml
<Smerdyakov> tspier2, you should read the Pervasives manual page that I pointed you to weeks ago.
<tspier2> Smerdyakov, if I could understand what all the arrows meant, then I would.
<Smerdyakov> If you can't understand that, then it's time to read the language tutorial.
<Smerdyakov> tspier2, there is no trial-and-error way to learn to use OCaml effectively. You must be willing to read.
<tspier2> I am willing to read, if time allows during the day. There is only so much time I have to do things. I have school and homework, which is over half the day. I need to sleep, and that lives me with a quarter of the day to eat and get misc. stuff done.
<Smerdyakov> Well, if you have time to try to program in OCaml, then you can use that time to read as much as you need to read to proceed.
<tspier2> Okay
khaladan has quit [Read error: 104 (Connection reset by peer)]
tspier2 has quit ["Leaving"]
Submarine has quit ["Leaving"]
Sysop_fb has quit [Nick collision from services.]
Sysop_fb has joined #ocaml
ramki is now known as ramkrsna
mrsolo_ has quit [Connection reset by peer]
mrsolo_ has joined #ocaml
Smerdyakov has quit ["Leaving"]
pauldia has joined #ocaml
Snark has joined #ocaml
mikeX has joined #ocaml
mikeX has quit ["leaving"]
pango is now known as pangoafk
love-pingoo has joined #ocaml
pangoafk is now known as pango
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
srle_ has joined #ocaml
<srle_> hi all
mrsolo_ has joined #ocaml
<srle_> why ocaml interpreter has introspective capabilities and ocaml compiler doesnt?
<srle_> example
<srle_> let x = 4;;
<srle_> x;;
<srle_> - : int = 4
<srle_> This means that ocaml interpreter knows the type of x.
<srle_> Why ocaml compiler doesnt have same posibility?
<love-pingoo> first it parses you string, then types it, then evaluates it
<love-pingoo> once it's typed the type info is removed (when translating to bytecode)
<srle_> Whe I type: x;;
<srle_> where is type info stored?
<love-pingoo> I guess you can embed kind of interactive toploop in your ocaml programs, but that's different
<srle_> why there isnt some function like : print_poly x;;
<srle_> that will get the type and apply correct print
<love-pingoo> srle_: it's not stored anywhere once the code is compiled (even in the toploop)
<srle_> OK. but?
<srle_> let x = 4;;
<srle_> this gets compiled and type info removed
<srle_> how does ocaml interpretek knows type info when I type: x;;
<srle_> I am talking about top level interactive ocaml.
<pango> toploop does keep such info, it's necessary because it's doing something that could be called "incremental compilations"
<love-pingoo> srle_: the toplevel parses, then types (remembers the type), then compiles to bytecode (no type info there), then prints according to the type it infered earlier
<love-pingoo> I guess
<srle_> ok, why there isnt such info in compiled program? or why there isn't any option to comiple program with that info?
<pango> srle_: because most of the time it's not necessary
<love-pingoo> mmm we could think of something similar for print_poly.. but I don't think camlp4 has access to type info
<pango> love-pingoo: no, camlp4 has no access to types
<srle_> something similar is called gcaml
<srle_> but that isnt standard
<pango> srle_: yes, adhoc polymorphism
<love-pingoo> srle_: caml wants to be fast, that's why the bytecode (and native code) doesn't include types
<srle_> but I think that ocaml would benefit from gcaml by adding features from it.
<love-pingoo> srle_: they might loose some features the OCaml team really want
<love-pingoo> typically modular compilation
<srle_> love-pingoo : can you expain it a little, please
<love-pingoo> you can infer at compile time which function to use instead of print_poly according to the infered type, but it excludes modular compilation
_fab has joined #ocaml
<love-pingoo> if you have a function 'a -> unit which as a side effect prints using print_poly, then it cannot be compiled once-for-all
<love-pingoo> instead you need to compile all the modules from source at the same time when producing the binary -- which MLton does, but is heavy
<srle_> i think hat specialization can take place
<srle_> for primitive types you will have several print functions
<srle_> yes, it will give larger code but you will have something like synamic typing
<love-pingoo> srle_: I think you didn't get my point
<pango> ocaml has strong static typing
<srle_> pango : and?
<pango> if you want to add dynamic typing, it becomes a totally different language
<love-pingoo> if you want to compile (to bytecode, without type information) a ('a -> ...) function, then you cannot use print_poly in it, otherwise, how would it distinguish between two same representations of different types (say, float and int64)
<srle_> love-pingoo : take a look at : Printf.printf takes type infrom from the first arguemnt
<srle_> this can be called a hack
<srle_> same can be done from print_poly a;;
<srle_> but the type will be taken from 'tag of a'
<srle_> soemthing like that
<love-pingoo> srle_: that's different, when you compile a (Printf.printf format ...) statement you know the types of you arguments
<srle_> yes an no
<srle_> gcaml adds ceation of generic functions
<srle_> you can say: let f = generic and so on
<srle_> and only generic function will look for type infrom
<srle_> rest of the language will be the same
<srle_> there could be a problem with classes, but I don't think that to many people develop OOP in ocaml
<pango> if it was so simple gcaml would be finished and we would all be using gcaml by now (or maybe ocaml would have added all gcaml features, to the same effect)
<srle_> pango : posibly
<love-pingoo> srle_: as I said, there must be some drawbacks. Does gcaml support modular compilation ?
<love-pingoo> is it as fast as Caml ?
<pango> toplevel and debugger have pluggable printers (#install_printer, #remove_printer), but I suppose such mecanism cannot be used in compiled programs ?
<srle_> love-pingoo : I think that it would be slower but I think that developers productivity will increse.
<srle_> pango: can it be used in byte code?
<pango> (many interesting things in the mailing list archive, looking for "polymorphic print")
<pango> byte code is compiled, too
<love-pingoo> srle_: I'm not against extensions, I just try to explain why OCaml isn't gCaml
<pango> there's just as much type information in bytecode than in native compiled objects
srle_ has left #ocaml []
Revision17 has quit [Read error: 110 (Connection timed out)]
Skal has joined #ocaml
slipstream has quit [Remote closed the connection]
flux__ has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
jsalfi has joined #ocaml
jsalfi has left #ocaml []
flux__ has joined #ocaml
vin100 has joined #ocaml
PierreTramo has quit [Read error: 113 (No route to host)]
Banana_ has quit [Read error: 110 (Connection timed out)]
mattam has quit [Read error: 110 (Connection timed out)]
julbouln has joined #ocaml
<julbouln> hi
slipstream-- has joined #ocaml
slipstream has quit [Connection timed out]
mattam has joined #ocaml
Banana has joined #ocaml
snafu_ has joined #ocaml
<snafu_> hi
<zmdkrbou> lo
benedikt_ has joined #ocaml
benedikt_ has left #ocaml []
dylan has quit [Read error: 104 (Connection reset by peer)]
dylan has joined #ocaml
benedikt_ has joined #ocaml
flux__ has quit [Remote closed the connection]
flux__ has joined #ocaml
love-pingoo has quit ["Leaving"]
srle_ has joined #ocaml
Revision17 has joined #ocaml
benedikt_ has left #ocaml []
TaXules has joined #ocaml
benedikt_ has joined #ocaml
snafu_ has quit ["bbl"]
<benedikt_> Values do not match: val pp_ht : ('_a -> string) -> ('_b -> string) -> ('_a, '_b) Hashtbl.t -> string
<benedikt_> is not included in val pp_ht :('a -> string) -> ('b -> string) -> ('a, 'b) Hashtbl.t -> string
<benedikt_> what a nice error message
* zmdkrbou finds this one clear :)
<zmdkrbou> you have a weak polymorphism problem
<benedikt_> easy to fix; but can't see a reason for this one
<zmdkrbou> '_a is different from 'a
<zmdkrbou> you are using references i suppose ?
<benedikt_> no; not at all
<zmdkrbou> mmh
<zmdkrbou> it probably comes from the hash table
<zmdkrbou> it's implemented using references
thresh has left #ocaml []
<benedikt_> aha. it's a hashtable to string
<benedikt_> let pp_ht = pp_ht_gen "," " => "
<zmdkrbou> your interface says that pp_ht is a polymorphic function, but it isn't
<zmdkrbou> what is the definition of pp_ht_gen ?
<benedikt_> let pp_ht str_of_key str_of_val ht = pp_ht_gen "," " => " str_of_key str_of_val ht
<benedikt_> works
<benedikt_> val pp_ht_gen : string -> string -> ('a -> string) -> ('b -> string) -> ('a,'b) Hashtbl.t -> string
<zmdkrbou> strange :\
<flux__> that's how it works.
<flux__> only a minor nuisance, though
<benedikt_> btw, it's a 'implementation does not match interface' error
<benedikt_> let me guess: no type annotations needed - many tradeoffs neccessary; what a strange philosophy
<flux__> there were some reasons why that is so :)
<pango> I think the tradeoffs comes more from strong static typing than from type inference
PierreTramo has joined #ocaml
Snark has quit [Read error: 104 (Connection reset by peer)]
Snark has joined #ocaml
smimou has joined #ocaml
pango is now known as pangoafk
Smerdyakov has joined #ocaml
pangoafk is now known as pango
dark_light has quit [Remote closed the connection]
khaladan has joined #ocaml
khaladan has quit [" HydraIRC -> http://www.hydrairc.com <- Leading Edge IRC"]
Snark has quit ["Leaving"]
srle has quit [Read error: 110 (Connection timed out)]
Revision17 has quit ["Ex-Chat"]
Submarine has joined #ocaml
srle_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
benedikt_ has quit ["Download Gaim: http://gaim.sourceforge.net/"]
lispy has joined #ocaml
pauldia has quit [Read error: 110 (Connection timed out)]
julbouln is now known as julbouln64
PierreTramo has quit ["Ex-Chat"]
Schmurtz has quit ["Plouf !"]
smimou has quit ["bli"]
PierreTramo has joined #ocaml
Skal has quit [Remote closed the connection]
_fab has quit []
PierreTramo is now known as GCarrier
GCarrier is now known as PierreTramo
CosmicRay has joined #ocaml