* [Caml-list] [Batteries or Camlp4] Functionaly updating several fields in an object
@ 2012-10-23 12:24 Ivan Gotovchits
2012-10-23 13:30 ` Gabriel Scherer
0 siblings, 1 reply; 4+ messages in thread
From: Ivan Gotovchits @ 2012-10-23 12:24 UTC (permalink / raw)
To: caml-list
I do not know whether the following behaviour is a bug or a feature, so
I've decided to consult with a community.
Given a simple definition:
let create () =
object
val a = []
val b = []
method step = {< a = a; b = b; >}
end
when compiling using batteries extensions:
ocamlfind ocamlc -c -package batteries.syntax -package lablgtk2
-package lablgtk2.init -package oUnit -package threads -package uuidm
-syntax camlp4o -thread -package batteries -syntax camlp4o -I +gsl -I
+res -I +xml-light -I +lablgtk2 -I gui -o gui/bug.cmo gui/bug.ml
I'm receiving the following error:
File "gui/bug.ml", line 7, characters 10-11:
Warning S: this expression should have type unit.
File "gui/bug.ml", line 8, characters 6-11:
Error: This expression has type bool but an expression was expected of type
'a list
It seems that compilet thinks that something like this:
«a = begin a; b = b end».
After disabling syntax extension everything is ok.
So the questions:
1) Is this a bug? If not, then how to overcome this unwanted behaviour?
2) If this is a bug? What must be blamed: camlp4 or Batteries?
Thanks in advance, for any comments!
P.S. My setup:
OS: Debian Squeeze 6.0.5
Objective Caml: 3.11.2
Batteries: 1.2.2-1
--
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
...."Have you mooed today?"...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] [Batteries or Camlp4] Functionaly updating several fields in an object
2012-10-23 12:24 [Caml-list] [Batteries or Camlp4] Functionaly updating several fields in an object Ivan Gotovchits
@ 2012-10-23 13:30 ` Gabriel Scherer
2012-10-23 13:57 ` Ivan Gotovchits
0 siblings, 1 reply; 4+ messages in thread
From: Gabriel Scherer @ 2012-10-23 13:30 UTC (permalink / raw)
To: Ivan Gotovchits; +Cc: caml-list
It appears to be a parsing bug in the 3.11 version of Camlp4. It
happens neither with 3.10.2 or with more recent version.
(I was lucky to find a machine with 3.11.2 installed; it's good to
have rarely-updated servers around)
Steps to reproduce:
camlp4o -str 'let _ = {< a = a; b = b >}'
Observed result:
{< a = (a; b = b); >}
Upgrading to a more recent version of OCaml would solve your problem.
Otherwise, not using syntax extensions is also fine.
On Tue, Oct 23, 2012 at 2:24 PM, Ivan Gotovchits <ivg@ieee.org> wrote:
>
> I do not know whether the following behaviour is a bug or a feature, so
> I've decided to consult with a community.
>
> Given a simple definition:
>
> let create () =
> object
> val a = []
> val b = []
> method step = {< a = a; b = b; >}
> end
>
> when compiling using batteries extensions:
>
> ocamlfind ocamlc -c -package batteries.syntax -package lablgtk2
> -package lablgtk2.init -package oUnit -package threads -package uuidm
> -syntax camlp4o -thread -package batteries -syntax camlp4o -I +gsl -I
> +res -I +xml-light -I +lablgtk2 -I gui -o gui/bug.cmo gui/bug.ml
>
> I'm receiving the following error:
> File "gui/bug.ml", line 7, characters 10-11:
> Warning S: this expression should have type unit.
> File "gui/bug.ml", line 8, characters 6-11:
> Error: This expression has type bool but an expression was expected of type
> 'a list
>
> It seems that compilet thinks that something like this:
> «a = begin a; b = b end».
>
> After disabling syntax extension everything is ok.
>
> So the questions:
> 1) Is this a bug? If not, then how to overcome this unwanted behaviour?
> 2) If this is a bug? What must be blamed: camlp4 or Batteries?
>
>
> Thanks in advance, for any comments!
>
> P.S. My setup:
> OS: Debian Squeeze 6.0.5
> Objective Caml: 3.11.2
> Batteries: 1.2.2-1
>
>
>
>
> --
> (__)
> (oo)
> /------\/
> / | ||
> * /\---/\
> ~~ ~~
> ...."Have you mooed today?"...
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] [Batteries or Camlp4] Functionaly updating several fields in an object
2012-10-23 13:30 ` Gabriel Scherer
@ 2012-10-23 13:57 ` Ivan Gotovchits
2012-10-23 14:03 ` Edgar Friendly
0 siblings, 1 reply; 4+ messages in thread
From: Ivan Gotovchits @ 2012-10-23 13:57 UTC (permalink / raw)
To: Gabriel Scherer; +Cc: caml-list
Gabriel Scherer <gabriel.scherer@gmail.com> writes:
> It appears to be a parsing bug in the 3.11 version of Camlp4. It
> happens neither with 3.10.2 or with more recent version.
> (I was lucky to find a machine with 3.11.2 installed; it's good to
> have rarely-updated servers around)
>
> Steps to reproduce:
> camlp4o -str 'let _ = {< a = a; b = b >}'
> Observed result:
> {< a = (a; b = b); >}
>
> Upgrading to a more recent version of OCaml would solve your problem.
> Otherwise, not using syntax extensions is also fine.
>
Unfortunately, I cannot upgrade to a more recent version. Because I'm
restricted to use a certified software...
Though, many thanks for clarifying the issue!
--
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
...."Have you mooed today?"...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] [Batteries or Camlp4] Functionaly updating several fields in an object
2012-10-23 13:57 ` Ivan Gotovchits
@ 2012-10-23 14:03 ` Edgar Friendly
0 siblings, 0 replies; 4+ messages in thread
From: Edgar Friendly @ 2012-10-23 14:03 UTC (permalink / raw)
To: caml-list
On 10/23/2012 9:57 AM, Ivan Gotovchits wrote:
> Unfortunately, I cannot upgrade to a more recent version. Because I'm
> restricted to use a certified software... Though, many thanks for
> clarifying the issue!
Luckily, batteries works just fine without camlp4. Many people,
including some of the main developers, use it without camlp4. Simply
remove the `batteries.syntax` dependency and only depend on `batteries`,
and the rest of batteries will work correctly.
E.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-23 14:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-23 12:24 [Caml-list] [Batteries or Camlp4] Functionaly updating several fields in an object Ivan Gotovchits
2012-10-23 13:30 ` Gabriel Scherer
2012-10-23 13:57 ` Ivan Gotovchits
2012-10-23 14:03 ` Edgar Friendly
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox