From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=HTML_MESSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 15E38BBCA for ; Thu, 20 Mar 2008 14:40:43 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvYEAJYF4kfAXQIm/2dsb2JhbACCPDanZw X-IronPort-AV: E=Sophos;i="4.25,531,1199660400"; d="scan'208";a="24001308" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 20 Mar 2008 14:40:42 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m2KDeZi0001581 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 20 Mar 2008 14:40:42 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhEBAJYF4kdA6aq9jWdsb2JhbACCPDaOEgEBAQEJAwkJFJkf X-IronPort-AV: E=Sophos;i="4.25,531,1199660400"; d="scan'208";a="8613611" Received: from rn-out-0910.google.com ([64.233.170.189]) by mail2-smtp-roc.national.inria.fr with ESMTP; 20 Mar 2008 14:40:37 +0100 Received: by rn-out-0910.google.com with SMTP id i50so734195rne.11 for ; Thu, 20 Mar 2008 06:40:36 -0700 (PDT) Received: by 10.142.147.15 with SMTP id u15mr1171720wfd.149.1206020435490; Thu, 20 Mar 2008 06:40:35 -0700 (PDT) Received: by 10.142.11.6 with HTTP; Thu, 20 Mar 2008 06:40:35 -0700 (PDT) Message-ID: <71767b800803200640i291c837fkb7d36e06f1415ea9@mail.gmail.com> Date: Thu, 20 Mar 2008 09:40:35 -0400 From: "Ralph Douglass" To: "Caml List" Subject: unused variable error with objects MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1623_31386427.1206020435487" X-Miltered: at discorde with ID 47E26953.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; -warn-error:01 foo:01 foo:01 ocamlc:01 -warn-error:01 ocamlc:01 compile:01 compile:01 compiles:01 compiles:01 functions:01 functions:01 mly:01 mly:01 string:02 ------=_Part_1623_31386427.1206020435487 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I'm a little confused by some code that I'm trying to compile some code with "-w Ae -warn-error Ae". Below is an examle: class foo = object method bar ~(snoo : string) = () end;; let biff = new foo;; biff#bar ~snoo:"hi";; When I compile it (ocamlc -c -w Ae -warn-error Ae foo.ml), as expected, I get: File "foo.ml", line 2, characters 15-19: Warning Z: unused variable snoo. With labeled functions, I usually do something like ~snoo:_, but it does not work in this exampled with methods: --- class foo = object method bar ~(snoo : string):_ = () end;; let biff = new foo;; biff#bar ~snoo:"hi";; -- ocamlc -c -w Ae -warn-error Ae foo.ml File "foo.ml", line 2, characters 15-19: Warning Z: unused variable snoo. On a whim, I did the following, which surprisingly worked: class foo = object method bar ~(_snoo : string) = () end;; let biff = new foo;; biff#bar ~_snoo:"hi";; And that compiles, which confused me. But I have to put the underbar into the method call, which seems wrong. Is there a solution to this? I'm running 3.10.1, from godi. Thanks! -- Ralph ------=_Part_1623_31386427.1206020435487 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I'm a little confused by some code that I'm trying to compile some code with "-w Ae -warn-error Ae".

Below is an examle:

class foo = object
  method bar ~(snoo : string) = ()
end;;

let biff = new foo;;
biff#bar ~snoo:"hi";;

When I compile it (ocamlc -c -w Ae -warn-error Ae foo.ml), as expected, I get:
File "foo.ml", line 2, characters 15-19:
Warning Z: unused variable snoo.

With labeled functions, I usually do something like ~snoo:_, but it does not work in this exampled with methods:
---
class foo = object
  method bar ~(snoo : string):_ = ()
end;;

let biff = new foo;;
biff#bar ~snoo:"hi";;
--
ocamlc -c -w Ae -warn-error Ae foo.ml
File "foo.ml", line 2, characters 15-19:
Warning Z: unused variable snoo.

On a whim, I did the following, which surprisingly worked:

class foo = object
  method bar ~(_snoo : string) = ()
end;;

let biff = new foo;;
biff#bar ~_snoo:"hi";;

And that compiles, which confused me.  But I have to put the underbar into the method call, which seems wrong.
Is there a solution to this?

I'm running 3.10.1, from godi.

Thanks!

--
Ralph ------=_Part_1623_31386427.1206020435487--