[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Sebastien Ferre <ferre@i...> |
| Subject: | syntax changes from 3.08 to 3.10 |
Hi,
moving my application from OCaml 3.08 to 3.10,
I encountered 2 syntax problems, i.e. syntax errors
when compiling:
1. record copy and modification:
{f x with y = 1; z = 2}
this can be solved by parenthesizing the
evaluation of the record to be copied.
{(f x) with y = 1; z = 2}
2. object copy and modification in a method:
{< x = 1; y = 2>}
OCaml says the first field is a bool instead of an int,
which leads me to think it parenthesizes in the following way:
{< x = (1; y = 2)>}
In fact, this behaviour is only when compiling with camlp4o:
ocamlc -pp ocamlp4o ...
The work-around I found to implement a copy method is as follows:
class c =
object (self)
val x = 0
val y = 0
method copy = (Oo.copy self) # copy_aux
method private copy_aux = x <- 1; y <- 2; self
end
Has anybody encountered the same problem ? Is there a better workaround
? Is it a bug ?
Sébastien