caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] duplicate labels
Date: Thu, 19 Sep 2013 11:29:13 +0200	[thread overview]
Message-ID: <20130919092913.GB25801@frosties> (raw)
In-Reply-To: <52385DFF.40806@etorok.net>

On Tue, Sep 17, 2013 at 04:49:51PM +0300, Török Edwin wrote:
> On 09/17/2013 04:09 PM, Gabriel Scherer wrote:
> > I think this is also related to
> >   http://caml.inria.fr/mantis/view.php?id=6070
> > 
> > Note that enabling warning 27 (non-suspicious unused variables) also solves this issue:
> > 
> >  % ocaml -w +27
> >         OCaml version 4.00.1
> > 
> > # let foo ~x ~x () = x;;
> > Warning 27: unused variable x.
> > val foo : x:'a -> x:'b -> unit -> 'b = <fun>
> 
> I thought that is just because I don't use x in the function, but you are right it warns even if I use x
> and I have the duplicate label:
> 
> # let foo ~x ~x () = x;;        
> Warning 27: unused variable x.
> val foo : x:'a -> x:'b -> unit -> 'b = <fun>
> 
> I think thats good enough for me now, I'll pay more attention to the unused variable warning.
> 
> Best regards,
> --Edwin

What about this code?

# let foo y ~x = 2 * x + y;;
val foo : int -> x:int -> int = <fun>
# let bar ~x = foo x;;
val bar : x:int -> x:int -> int = <fun>
# let x = 1;;
val x : int = 1
# bar ~x ~x;;
- : int = 3
# bar ~x:1 ~x:2;;
- : int = 5

Other than being confusing there doesn't seem to be anything wrong with
a duplicate label. It just requires you to apply the ~x in order.

MfG
	Goswin

  reply	other threads:[~2013-09-19  9:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 12:55 Török Edwin
2013-09-17 13:01 ` Lukasz Stafiniak
2013-09-17 13:09 ` Gabriel Scherer
2013-09-17 13:49   ` Török Edwin
2013-09-19  9:29     ` Goswin von Brederlow [this message]
2013-09-19 10:39       ` Lukasz Stafiniak

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=20130919092913.GB25801@frosties \
    --to=goswin-v-b@web.de \
    --cc=caml-list@inria.fr \
    /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).