caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Ivan Gotovchits <ivg@ieee.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] [Batteries or Camlp4] Functionaly updating several fields in an object
Date: Tue, 23 Oct 2012 15:30:41 +0200	[thread overview]
Message-ID: <CAPFanBG3nrmmfYG4i-QegYcaorHkJX=+3+YEQV4mqJF8GZQf1w@mail.gmail.com> (raw)
In-Reply-To: <877gqhnzq1.fsf@golf.niidar.ru>

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

  reply	other threads:[~2012-10-23 13:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23 12:24 Ivan Gotovchits
2012-10-23 13:30 ` Gabriel Scherer [this message]
2012-10-23 13:57   ` Ivan Gotovchits
2012-10-23 14:03     ` Edgar Friendly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPFanBG3nrmmfYG4i-QegYcaorHkJX=+3+YEQV4mqJF8GZQf1w@mail.gmail.com' \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=ivg@ieee.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).