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.