dark_light changed the topic of #ocaml to: OCaml 3.09.2 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/
dark_light has joined #ocaml
dark_light has quit [Remote closed the connection]
dark_light has joined #ocaml
cmeme has quit [Read error: 110 (Connection timed out)]
dbueno has quit ["Leaving"]
_coder_ has quit ["Leaving"]
love-pingoo has quit ["Connection reset by pear"]
cmeme has joined #ocaml
khaladan has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
_coder_ has joined #ocaml
_coder_ has quit [Connection reset by peer]
hikozaemon has joined #ocaml
_coder_ has joined #ocaml
Aradorn has joined #ocaml
Aradorn has quit [Client Quit]
mikeX has joined #ocaml
mikeX has quit ["zzzZz"]
mikeX__ has quit [Read error: 110 (Connection timed out)]
slipstream has quit [Remote closed the connection]
slipstream has joined #ocaml
dark_light is now known as darklight
darklight is now known as dark_light
shawn has quit ["This computer has gone to sleep"]
chessguy has joined #ocaml
dark_light is now known as darklight
dvekravy has quit [Read error: 104 (Connection reset by peer)]
dvekravy has joined #ocaml
darklight is now known as dark_light
sieni_ has quit [Read error: 110 (Connection timed out)]
khaladan has joined #ocaml
_coder_ has quit ["Leaving"]
Snark has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- Leading Edge IRC"]
dark_light has quit [No route to host]
shawn has joined #ocaml
love-pingoo has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
dark_light has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
_fab has joined #ocaml
<dark_light> i have a type config_t in the Config module (that is a file, config.ml), that is type config_t = { port : int; }, and i have a instance std, let std = { port = 4000 }, but when i use it in the file con.ml, typing let a = Config.std.port, and compile with ocamlc -o con.cmo -c con.ml, i get an error: Unbound record field label port
<dark_light> what i have to do for accessing types from another modules?
<dark_light> the compiler knows that it has the type config_t, because there are a .mli file..
<dark_light> when i type print_string Config.std it says: This expression has type Config.config_t but is here used with type string
<dark_light> so it should know that std has a port record value
<flux__> Config.std.Config.port (yeah..)
<dark_light> well, i think i don't understand...
<dark_light> even if i do let config = Config.std , i should use config.Config.port ?..
<flux__> yes
<dark_light> i have noticed that with functors i can make a type in a module equals to another in another module, can i do this with the implicit file-based module?
<dark_light> now i am looking for a way to import the Config.std to a local type
<dark_light> :(
<flux__> hm.. type std = Config.std ?
<flux__> or just open Config :)
<dark_light> type config_t = Config.config_t don't works..
<dark_light> open Config might be OK..
<dark_light> flux__, in functors, if i do type a = Anothermodule.a, i also have to setup the functor with the "with type a = Anothermodule.a", or anything like this.. for both types be the same
<dark_light> i don't remember exactly the syntax, but if i simply use type a = Config.a, i create just a copy
smimou has joined #ocaml
szsz has joined #ocaml
love-pingoo has joined #ocaml
pango is now known as pangoafk
pangoafk is now known as pango
dark_light has quit [No route to host]
rillig has joined #ocaml
smimou has quit [Remote closed the connection]
revision17_ has joined #ocaml
Revision17 has quit [Read error: 110 (Connection timed out)]
khaladan_ has joined #ocaml
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
hikozaemon has quit ["Leaving..."]
Yorick has joined #ocaml
rillig has quit [Remote closed the connection]
Schmurtz has joined #ocaml
coder_ has joined #ocaml
<Yorick> Is there a way to build ocaml with -O2? The build systems seems to add -O whatever I tell it.
<Yorick> And since -O then comes after -O2, it takes precedence.
<Yorick> Maybe there is no-one awake here. Meme pas des francophones?
<love-pingoo> Yorick: you can build your .o files using whatever gcc command you like, then directly give the .o to ocaml
<love-pingoo> Yorick: salut david, au fait
<Yorick> love-pingoo: Thank you, I just wanted to know if the build system supported that directly. I tried both setting the CFLAGS env variable and passing -cc to configure but neither worked.
<Yorick> I'm just a bit surprised that the build system did not appear to be optimised for speed by default.
<Yorick> salut :)
love-pingoo has quit ["Leaving"]
ppsmimou has quit ["Leaving"]
flux__ has quit [Remote closed the connection]
ppsmimou has joined #ocaml
Schmurtz has quit ["L'énergie semble manquer : dodo !"]
flux__ has joined #ocaml
Schmurtz has joined #ocaml
coder_ has quit ["Leaving"]
coder_ has joined #ocaml
coder_ has quit [Client Quit]
Aradorn has joined #ocaml
aradorn-- has joined #ocaml
Aradorn has quit [Read error: 110 (Connection timed out)]
aradorn-- has quit ["Leaving"]
Aradorn has joined #ocaml
vincenz has joined #ocaml
coder_ has joined #ocaml
coder_ has quit ["Leaving"]
_fab has quit [Remote closed the connection]
dark_light has joined #ocaml
<dark_light> there are a good parser for telnet socket servers? because my telnet is sending msgs with \r\n in the end, but another telnet might send it with \n (or it's default?)
<dark_light> and, there are any way to return some characters to a file descr? like the "ungetc" from C
khaladan has quit [Read error: 104 (Connection reset by peer)]
<pango> ungetc works on a FILE *, not a descriptor
Snark has quit [Read error: 104 (Connection reset by peer)]
Snark has joined #ocaml
<dark_light> pango, well, i remain with my problem
<dark_light> and there are difference between FILE * and file descriptors?
<pango> file descriptor is provided by the operating system, FILE are some abstraction wrapper from the libc library, that adds the buffering needed for such weird stuff as ungetc
<dark_light> hmmmmm yeah
<dark_light> pango, my problem is: i might read a packet with AAAABC, another packet with AAAA\r\nBBB
<dark_light> so i want to pass to my parser AAAABCAAAA (stripping off the \r\n) and continues to parse the BBB
<dark_light> because BBB command don't terminated yet
<dark_light> so i need a) to have a way to 'return' BBB to stream, and b) to have a good way to parse the \r\n thing.. because it can be only \n too i think.. (the second one is easier to make a low-level code..)
<dark_light> maybe the only way is using a buffer string to store "BBB", but it's very ugly..
<dark_light> well brb
<pango> well, if you were about to use ungetc, it must look very ugly to your eyes indeed ;)
finelemo1 has joined #ocaml
vincenz has left #ocaml []
<Yorick> dark_light: I doubt you are reading direct from a file descriptor anyway (reading single chars is very inefficient that way)
finelemo2 has joined #ocaml
finelemon has quit [Read error: 110 (Connection timed out)]
finelemo1 has quit [Read error: 110 (Connection timed out)]
<pango> well, if he uses channels from Pervasives, then yes, channels do have some buffering... not relying on libc streams, however
<pango> channels have 4kB buffers
<Yorick> Yes, but I thought channels had some kind of ungetc (it's easy to do when you are buffering anyway)
<Yorick> Otherwise you have to build a layer above channels with a small unget buffer.
<pango> while it could be doable (some case may be problematic, depending on implementation) I wouldn't advocate adding it... there's probably cleaner ways than pretending that the char wasn't read
<Yorick> well
<Yorick> Usually a table-built lexer doesn't need it (because it maintains its own lookahead)
<Yorick> s/table-built/table-based/
<Yorick> ocamllex certainly shouldn't as far as I know
coder_ has joined #ocaml
pango is now known as pangoafk
smimou has joined #ocaml
smimou has quit ["bli"]
coder_ has quit ["Leaving"]
love-pingoo has joined #ocaml
smimou has joined #ocaml
pangoafk is now known as pango
<dark_light> i am reading from sockets (that are file descriptors), Yorick
<dark_light> and i am reading entire strings, and this is just my problem
<dark_light> i can read a string not terminated by \n, eg "AAAAAA" so i have to continue reading
<dark_light> if the first string is "ABCD", the second is "XYZ\r\nHAHAHA" and the third is "OK\r\n", i have to pass the command ABCDXYZ and then the command HAHAHAOK to a parser
<dark_light> the commands *may* be splitted in some strings, so i am using buffers from Buffer module
<dark_light> but i don't know a good way to a) interpret A\n and A\r\n as the same thing and b) 'return' the HAHAHA thing so i can read HAHAHAOK\r\n next time (i may store HAHAHA in a temp variable too)
<Yorick> Why not interpret both \r and \n as terminators, and read another char if you get \r ?
<dark_light> Hmmmmmmmm.. yeah
<dark_light> but maybe i want to have a empty command, i am not sure
<dark_light> so A\r\n\r\nB and A\r\nB might don't be the same thing
<dark_light> i don't really specified this but your way seems to be good Yorick
<dark_light> i will just ignore \r, i don't know any client that sends just \r
<Yorick> Is this a telnet connection? I think \r\n is actually the standard line terminator in telnet and many other text-oriented internet protocols
<Yorick> see the relevant RFCs
yip has joined #ocaml
<yip> hello ocaml, how can i learn ocaml if i already know haskell?
<love-pingoo> probably
<love-pingoo> certainly
<Smerdyakov> yip, probably reading the manual tutorial would be sufficient.
<yip> ok cool thanks. another question: does ocaml have mutable linked lists, like c++ std::list?
<Smerdyakov> Not in the standard library, but they're trivial to implement.
<Yorick> If car-mutability is enough, you could make a list of references.
<yip> Yorick: don't think so, i need to be able to remove any single element
<Yorick> OK. Well, making one out of mutable records is probably what you want then.
<love-pingoo> I wonder why we don't have such a datastructure in the stdlib
<love-pingoo> is it in the extlib ?
<Yorick> There are a number of "extra libs" by people who were missing things in the standard lib
<yip> another question: i've looked through the Array docs and couldn't find a way to free an array, is this possible?
<Smerdyakov> yip, they're garbage collected.
<Yorick> GC baby GC
<yip> yeah, i'm wondering if it's possible to manually free them
<Yorick> yip: Not really. Why?
<Smerdyakov> No. Not possible for anything in ML.
<yip> i see.... well, GC will probably work ok i guess
<Yorick> Amusingly enough, the Scheme people are considering making ordinary lists immutable :)
<love-pingoo> nice
<Smerdyakov> It's About Time.
<Yorick> (There are good hard technical reasons for having it either way)
<dark_light> Yorick, do you know a site with some of these 'extra libs'?
<Yorick> dark_light: Sure, there are links from ocaml.org (look in the "hump").
<Yorick> The quality varies but some of them appear quite well-written.
<dark_light> ocaml hump is like a php pear?
<love-pingoo> kindof
<dark_light> good
<Yorick> dark_light: Maybe there are libs that will help you with your protocol parsing as well.
<dark_light> yes:)
<yip> one last question: does ocaml work well with unicode?
<dark_light> don't has native support, but there are some libs that workaround this
<yip> ok
<yip> ; operator is like haskell's IO bind function?
<Smerdyakov> No.
<Smerdyakov> It's defined like: let (;) x y = y
<mellum> a; b is let () = a in b
<Smerdyakov> Since everything is imperative in OCaml, no special semantics is needed.
<yip> hm...... ok i guess it makes sense
<dark_light> how ocaml can tell "x should have type unit" in a warning?
<mellum> dark_light: why shouldn't it be able to?
<dark_light> mellum, well, i can't make a function like this
<dark_light> a function that generates a warning just in compile time
<dark_light> it's not like (x : unit) and not like an Exception
<mellum> huh?
<Yorick> Do you want a compile-time assertion?
<dark_light> Yorick, it's really a compile-time assertion?
<dark_light> if yes, yes, i want a compile-time assertion, heh
<Yorick> I have no idea if that is what you mean.
<dark_light> hum
<Yorick> Can you give an example?
<dark_light> # 1; 2;;
<dark_light> Warning S: this expression should have type unit.
<dark_light> it says that 1 should have type unit
<dark_light> but allow 1 to be 'a
<Yorick> That's the rules of the ; operator. You can explicitly ignore a result if you like.
<Yorick> # ignore 1; 2 ;;
<dark_light> yip, how can i create a ;| operator with the same rule?
<Yorick> I don't think you can call it ;| for lexical reasons
<dark_light> well i meant.. how can i create a function with a similar behaviour?
<Yorick> let (|-) a b = ignore a; b ;;
<Yorick> # "foo" |- 38 ;; -> 38
<Yorick> (of course you could leave out the "ignore a;"
<Yorick> )
<dark_light> yes, but it don't has the type "Warning S: this expression should have type unit."
<dark_light> i want how the "Warning S: this expression should have type unit." was built
<dark_light> maybe for create a Warning S: this expression should have type foo.
<Yorick> I'm afraid I don't quite follow
<mellum> dark_light: it's hardcoded in the compiler. You can't get that.
<mellum> Well, not without hacking the compiler source, at least.
<Yorick> Right. You can't provoke arbitrary warnings from the compiler in the general case.
<dark_light> mellum, i see
<Yorick> Of course, you can print out to stderr from the toplevel. It could always fool someone :)
<Yorick> echo "foo: No such file or directory" > foo
Boojum has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
Boojum has quit ["Leaving"]
rillig has joined #ocaml
khaladan has joined #ocaml
Yorick has left #ocaml []
shawn_ has quit [Read error: 104 (Connection reset by peer)]
Aradorn has quit ["This computer has gone to sleep"]
shawn has quit ["This computer has gone to sleep"]
shawn has joined #ocaml
oracle1 has quit [Remote closed the connection]
oracle1 has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
smimou has quit ["bli"]