sponge45 changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/
a-priori_ has joined #ocaml
m3ga has joined #ocaml
mnemonic has quit ["leaving"]
JeffSmac has quit []
<tsuyoshi>
what is f#
JeffSmac has joined #ocaml
a-priori has quit [Read error: 110 (Connection timed out)]
<m3ga>
tsuyoshi: f# is an Ocaml like language developed by microsoft for the .NET platform. It is mostly just like Ocaml, but does have some minor differences.
smimou has quit ["bli"]
<mbishop>
They try to keep F# compatable with Ocaml, they have an mllib.dll
m3ga has quit ["disappearing into the sunset"]
<JeffSmac>
The differences are pretty significant I think.
<JeffSmac>
For instance you can't do s.[0] <- 'a' when s is a string because strings aren't mutable in .NET
<JeffSmac>
you have to use the StringBuilder class, but I never tried that in f#
<mbishop>
True, but strings are also unicode
<mbishop>
which is nice
<JeffSmac>
there's a unicode string library for ocaml, but I haven't tried it
<mbishop>
yeah, but it's probably just as much trouble to use that in OCaml, than to use strings as you demonstrated above in F# heh
<JeffSmac>
could be
<mbishop>
I haven't used enough F# to know either :P
JeffSmac has quit []
postalchris has joined #ocaml
postalchris has quit [Client Quit]
mikeX has quit ["leaving"]
shawn has quit ["This computer has gone to sleep"]
<tsuyoshi>
I always thought the mutable strings in ocaml were weird
zarvok has joined #ocaml
<tsuyoshi>
I've just been putting unicode into the regular ocaml strings and parsing it myself
<tsuyoshi>
it's not really too hard, honestly.. and the pcre library can do utf8 searching for you
<cmvjk>
here's a dumb question: if I have two files, foo.ml and bar.ml, and some part of foo calls a function in bar, and some (completely different) function in bar references a value in foo...that's not allowed?
<cmvjk>
and as a corrolary, I guess: why?
JeffSmac has joined #ocaml
johnnowak has joined #ocaml
zarvok has quit ["BitchX-1.1-final -- just do it."]
JeffSmac has quit []
lihaitao has joined #ocaml
lihaitao has left #ocaml []
vorago has quit [Read error: 60 (Operation timed out)]
johnnowak has quit []
Mr_Awesome has quit ["...and the Awesome level drops"]
pants1 has quit ["Leaving."]
<pango>
cmvjk: because the semantic of module loading is that it's the same as an evaluation
<pango>
cmvjk: add to that that module contain values... and that using uninitialized values is prohibited...
ramkrsna has joined #ocaml
<pango>
cmvjk: and you end up with the restriction you mention
<pango>
modules can't cross reference
<cmvjk>
is there a good solution to having two modules that, for instance, might need to reference each other once in a while? other than, perhaps, putting everything into one big module, or creating global references and filling them in with values upon evaluation of necessary module
<cmvjk>
keeping in mind that i have absolutely no experience in things like "planning the layout of a program"
<cmvjk>
but it seems to me that it would be useful to be able to have modules that reference each other...however nobody else seems to miss it
<tsuyoshi>
it seems like it might be useful, but I never needed to do it so I never really thought about it
smimou has joined #ocaml
smimou has quit [Client Quit]
Submarine has quit [Remote closed the connection]
love-pingoo has joined #ocaml
shawn has joined #ocaml
jlouis has quit [Remote closed the connection]
diffbavis has quit [Read error: 131 (Connection reset by peer)]
diffbavis has joined #ocaml
dark_light has quit [Remote closed the connection]
ramki has joined #ocaml
malc_ has joined #ocaml
david_koontz has joined #ocaml
m3ga has joined #ocaml
ikaros_ has joined #ocaml
yangsx has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
b00t has joined #ocaml
<flux->
cmvjk, usually you can create a new module to which both the old modules can refer to
<flux->
cmvjk, and the rest of the time you use the same approach but with function parameters to bind the two modules to each other
<flux->
cmvjk, however, if you have module-defined types involved, you need to put those types into a single module
<flux->
cmvjk, in my experience the problem rarely occurs, though, and moving code to the new module will likely infact make the program more well-structured :) - but of course, that sounds too much of an ocaml-fanboy explaining the limitations of the language.. ;-)
<flux->
about types, I of course meant: if the types are recursive
<flux->
(with each other)
vorago has joined #ocaml
b00t has quit [Connection timed out]
zarvok has joined #ocaml
yangsx has quit [Read error: 110 (Connection timed out)]
b00t has joined #ocaml
david_koontz has quit [Read error: 60 (Operation timed out)]
b00t has quit [Remote closed the connection]
zarvok has quit [zelazny.freenode.net irc.freenode.net]
diffbavis has quit [zelazny.freenode.net irc.freenode.net]
fremo has quit [zelazny.freenode.net irc.freenode.net]
Oatmeat|umn has quit [zelazny.freenode.net irc.freenode.net]
ppsmimou has quit [zelazny.freenode.net irc.freenode.net]
eradman has quit [zelazny.freenode.net irc.freenode.net]
descender has quit [zelazny.freenode.net irc.freenode.net]
gunark has quit [zelazny.freenode.net irc.freenode.net]
gim has quit [zelazny.freenode.net irc.freenode.net]
zarvok has joined #ocaml
diffbavis has joined #ocaml
fremo has joined #ocaml
descender has joined #ocaml
Oatmeat|umn has joined #ocaml
gunark has joined #ocaml
gim has joined #ocaml
ppsmimou has joined #ocaml
eradman has joined #ocaml
b00t has joined #ocaml
mikeX has joined #ocaml
<fremo>
type a = b list and b = a list
<fremo>
The type abbreviation a is cyclic
<flux->
you can enable that with -rectypes, or you can put in a constructor
<fremo>
the way to write it is with variant types ?
<fremo>
whoohoo ! :)
<fremo>
thank you :)
<flux->
happy to help :)
<fremo>
heh :)
<flux->
I haven't used -rectypes myself, but I've heard it might result in obscure error messages if you don't know what you're doing
<fremo>
heh, when you dont know what you are doing, compiler messages often seem obscures :)
<flux->
I meant in the sense that if you know what you're doing, you won't see error messages anyway :)
<fremo>
just some typo sometimes :)
b00t has quit [Remote closed the connection]
<love-pingoo>
without rectypes, on code like x::x, the compiler would say that x is used with type 'a list but has type 'a
<love-pingoo>
with rectypes it would infer x : ('a where 'a = 'a list) and raise an obscure error using that type later
ppsmimou has quit [Read error: 104 (Connection reset by peer)]
ppsmimou has joined #ocaml
<fremo>
love-pingoo: ok, thanks
<fremo>
but it seems that I don't know what I am doing, let simplify... :)
malc__ has joined #ocaml
malc__ has quit ["leaving"]
malc_ has quit [Read error: 110 (Connection timed out)]
love-pingoo has quit ["Leaving"]
slipstream has joined #ocaml
slipstream-- has quit [Read error: 113 (No route to host)]
pango has quit [Remote closed the connection]
jlouis has joined #ocaml
pango has joined #ocaml
zarvok has quit ["BitchX-1.1-final -- just do it."]
postalchris has joined #ocaml
rossberg has joined #ocaml
vorago has quit [Read error: 113 (No route to host)]
<postalchris>
Is there any way around the following problem?
<postalchris>
let my_fprintf = Printf.fprintf my_formatter
<postalchris>
The type of this expression, ('_a, out_channel, unit) format -> '_a,
<postalchris>
contains type variables that cannot be generalized
<postalchris>
(Short of parsing the format string myself?)
<postalchris>
s/formatter/out_channel/
love-pingoo has joined #ocaml
vorago has joined #ocaml
shawn has quit ["This computer has gone to sleep"]
descender has quit ["Elegance has the disadvantage that hard work is needed to achieve it and a good education to appreciate it. - E. W. Dijkstra"]
smimou has joined #ocaml
benny_ has joined #ocaml
bluestorm_ has joined #ocaml
benny has quit [Read error: 110 (Connection timed out)]
ikaros_ has quit [Read error: 113 (No route to host)]
Submarine has joined #ocaml
postalchris has quit [Read error: 110 (Connection timed out)]
shawn has joined #ocaml
david_koontz has joined #ocaml
<flux->
too bad he left, but the solution would be: let my_fprintf fmt = Printf.fprintf my_formatter fmt
<flux->
or: let my_fprintf fmt = Printf.ksprintf (fun s -> Printf.fprintf my_formatter "%s" s) fmt for a more generic expressions..
malc_ has joined #ocaml
<vorago>
I'm writting compiler in ocamllex, ocamlyacc. Would you find disturbing, managing variables list, their memory addresses and so on on lexer level?
<vorago>
I'm returning something like VARIABLE with semantic value equal to memory address.
zarvok has joined #ocaml
postalchris has joined #ocaml
kral has joined #ocaml
kral has left #ocaml []
Submarine has quit ["Leaving"]
<flux->
I haven't tried that with ocamllex.. I tried it with bison and flex once, and it wasn't quite as straightforward as I thought it would be
<flux->
but I can see it working. the only worrying thing is that if the .mly isn't evaluated at strictly as the tokens are.. that is, a token isn't constructed (in an invalid fashion) before the semantic level decides to construct the variable
<flux->
I don't think that can happen, though
<flux->
what I can suggest, though, is menhir. an excellent parser generator with many niceties ;-)
<flux->
(and backwards compatible with ocamlyacc)
rossberg has quit []
pants1 has joined #ocaml
zarvok has quit ["BitchX-1.1-final -- just do it."]
bk_ has joined #ocaml
bk_ has left #ocaml []
bluestorm_ has quit [Remote closed the connection]
mnemonic has joined #ocaml
<mnemonic>
hi
<vorago>
flux-, ;-)
<vorago>
flux-, I'll see this menhir. I've actually have a ready compiler which compiles code to ASM of my small VM. Not very feature full... but it works nevertheless. ;d
malc_ has quit ["leaving"]
<vorago>
flux-, but I'm using f. ex. lexer to count variables in function definition. Then it's passed as a semantic value of ) i guess which makes parser to prepare place on stack for them, and then when lexer finds them it returns their value.
<vorago>
It's somehow strange. But it works. I'm just curious if there aren't any better suited mechanisms for such actions. ;d
Smerdyakov has joined #ocaml
shawn has quit [Read error: 104 (Connection reset by peer)]