<pattern>
i get a "Warning: line 8, chars 46-47: Invalid backslash escape in string"
<pattern>
but using a backslash to escape a period is normal in regular expressions... and is even documented in str.mli
<pattern>
and, again, used to work in ocaml 3.06 :(
<pango>
yes, \s are used in strings, before they're transformed into regexpes
<pango>
but in ocaml code, \s need to be doubled
<pattern>
ah
<pattern>
something else new
<pango>
notice the compiler just throws a warning, the code is still compiled
<pattern>
so is it a valid regex with just a single \s ?
<pattern>
or do i need to double it?
<pango>
depends whether you're talking about content of string, or ocaml source to generate it
<pattern>
in the ocaml source that will be compiled in to a string that will in turn be made in to a regex, as i have in my example prog above
<pango>
if, say, you want \( in the string, in code you must type \\(
<pango>
because backslash sequences will be checked (and converted) at compile time
<pattern>
cool... ok, that worked
<pattern>
thanks, pango
<pango>
np
<pango>
I suppose 3.06 was just more silent about the issue
<pattern>
not just more silent, it didn't need the doubled \s
<pattern>
at least not for the regex to work
<pattern>
i'm going through an old prog of mine i haven't touched in years
<pattern>
used to compile just fine
<pango>
as I said, it still works with single \s, I don't think it stops compilation
<pattern>
but, as you can see, there have been a few changes in ocaml :)
<pattern>
oh
<pattern>
maybe it was just more silent then
<pango>
I guess so. Maybe Changelog would confirm
<pattern>
doesn't really matter much to me... i don't intend to go back to 3.06
<pango>
"Warnings for ill-formed \ escapes in string and character literals."... but in 3.05 changelog ;)
<pattern>
oh, maybe this source is older than i thought
mikeX has quit ["zz"]
dark_light has quit [Read error: 104 (Connection reset by peer)]
Smerdyakov has quit ["Leaving"]
bluestorm has joined #ocaml
slipstream has joined #ocaml
slipstream-- has quit [Read error: 110 (Connection timed out)]
Sir_Diddymus has joined #ocaml
__DL__ has joined #ocaml
Submarine_ has joined #ocaml
Submarine has quit [Nick collision from services.]
Submarine_ is now known as Submarine
dark_light has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 60 (Operation timed out)]
<bluestorm>
hum
<bluestorm>
in a file socket.ml i have a type socket = { name : string };; type declaration
<ketty>
hum hum ^^
<bluestorm>
in another file i manipulate data from this type
<bluestorm>
and data.name doesn't work
<ketty>
data.Socket.name
<bluestorm>
i have to put data.Socket.name
<bluestorm>
yes
<bluestorm>
but then i've done in the second file
<bluestorm>
type client = Socket.socket;;
<bluestorm>
i thought this way i would be able to do data.name
<bluestorm>
but it still isn't possible
<ketty>
yes
<bluestorm>
why ?
<bluestorm>
i thought aliasing the type would allow me to use it locally
<ketty>
the record-field 'name' is in the namespace of Socket
<bluestorm>
hum
<bluestorm>
is there a correct way to report it in the other file ?
<bluestorm>
because re-declaring the same record seems me dummy
<pango>
open Socket
<bluestorm>
hum
<ketty>
yes
<bluestorm>
there is no way to export only the record ?
<ketty>
if Socket is to big, you can move the type declaration into a nested module..
<bluestorm>
and open it then ?
<bluestorm>
hum
<ketty>
yes
<bluestorm>
actually socket is pretty small
<bluestorm>
so there is no problem in opening it
<ketty>
good :)
<bluestorm>
hum i think i'll stay with data.Socket.name
<bluestorm>
i don't like to open thigns with no serious reason
<bluestorm>
(hum "without any serious reason", sorry)
<ketty>
is there ever a "serious" reason?
<bluestorm>
hum
<bluestorm>
when i have type-only modules
<bluestorm>
shared everywhere
<bluestorm>
this is a serious reason
<ketty>
ok :)
<ketty>
<-- is using a lot of lazy reasons =)
<bluestorm>
but in most of case open make code harder to understang, in my opinion
<ketty>
yes
<ketty>
true
<bluestorm>
always asking "where is this function defined ?"
<ketty>
mostly i bind modules to one-letter-names...
<pango>
same for fields names, no ? ;)
<pango>
actually type socket = Socket.socket may work, in some contexts
<pango>
mmmh not really, socket seems to be now abstract
<pango>
you can use functions from Socket over it, but not access its structure directly, according to some tests
love-pingoo has joined #ocaml
<pango>
bluestorm: there's also ketty's suggestion, module S = Socket then you can write recordname.S.filename... depending on what you find less cryptic ;)
<bluestorm>
hum
<bluestorm>
recordname.Socket.rowname is ok
<bluestorm>
a few more letters doesn't cost me too much
dark_light has quit [Read error: 104 (Connection reset by peer)]
eternite has joined #ocaml
slipstream-- has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
Submarine has quit [Nick collision from services.]
menace has joined #ocaml
<eternite>
I have a problem.
<eternite>
Why this : "let str = Marshal.to_string g [Marshal.No_sharing;Marshal.Closures];;"
<eternite>
raise : "Exception: Invalid_argument "output_value: abstract value (outside heap)"."