I submitted a bug report.
2008/1/25, Oliver Bandel <oliver@first.in-berlin.de>:> Zitat von Ashish Agarwal <agarwal1975@gmail.com>:> [...]
>
> > I was hoping there would be some follow up discussion on the code
> > below, but
> > haven't seen anything yet.
> [...]
>> It behaves like if s would be defined on top of theOuch: this is the same as in C: the attempt to modify a statically
> module, but it is local constructed in the function f.
> Look sstrange... I have the same behaviour here (Debians
> OCaml here is 3.09.2, and I have tried with toplevel, bytecode
> and naticecode).
defined string makes bad things happen. One should try this on Open
BSD: it may even crash, if the the data segment is protected from
write. Replacing "abc" by String.copy "abc" works around this, though:
# let f () = let s = String.copy "bla" in let c = s.[0] in s.[0] <- 'c' ; c ;;val f : unit -> char = <fun>- : char = 'b'
# f();;
- : char = 'b'
# f();;
Pure again :-)
Cheers,
Loup
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs