* [Caml-list] duplicate labels
@ 2013-09-17 12:55 Török Edwin
2013-09-17 13:01 ` Lukasz Stafiniak
2013-09-17 13:09 ` Gabriel Scherer
0 siblings, 2 replies; 6+ messages in thread
From: Török Edwin @ 2013-09-17 12:55 UTC (permalink / raw)
To: caml-list
Hi,
The following is accepted:
let foo ~x ~x () = ()
let () =
foo ~x:4 ~x:5 ()
I tried -w A and I got no warnings with OCaml 4.01.0, is this intended?
Should I file a feature request to get a warning for this situation?
(How I got in this situation: I did an overly eager search/replace that caused the duplicate ~x)
Best regards,
--Edwin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] duplicate labels
2013-09-17 12:55 [Caml-list] duplicate labels Török Edwin
@ 2013-09-17 13:01 ` Lukasz Stafiniak
2013-09-17 13:09 ` Gabriel Scherer
1 sibling, 0 replies; 6+ messages in thread
From: Lukasz Stafiniak @ 2013-09-17 13:01 UTC (permalink / raw)
To: Török Edwin; +Cc: Caml
[-- Attachment #1: Type: text/plain, Size: 802 bytes --]
I reported this a couple of years ago:
http://caml.inria.fr/mantis/view.php?id=4904
On Tue, Sep 17, 2013 at 2:55 PM, Török Edwin <edwin+ml-ocaml@etorok.net>wrote:
> Hi,
>
> The following is accepted:
>
> let foo ~x ~x () = ()
> let () =
> foo ~x:4 ~x:5 ()
>
> I tried -w A and I got no warnings with OCaml 4.01.0, is this intended?
> Should I file a feature request to get a warning for this situation?
>
> (How I got in this situation: I did an overly eager search/replace that
> caused the duplicate ~x)
>
> Best regards,
> --Edwin
>
> --
> 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
>
[-- Attachment #2: Type: text/html, Size: 1553 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] duplicate labels
2013-09-17 12:55 [Caml-list] duplicate labels 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
1 sibling, 1 reply; 6+ messages in thread
From: Gabriel Scherer @ 2013-09-17 13:09 UTC (permalink / raw)
To: Török Edwin; +Cc: caml users
[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]
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>
On Tue, Sep 17, 2013 at 2:55 PM, Török Edwin <edwin+ml-ocaml@etorok.net>wrote:
> Hi,
>
> The following is accepted:
>
> let foo ~x ~x () = ()
> let () =
> foo ~x:4 ~x:5 ()
>
> I tried -w A and I got no warnings with OCaml 4.01.0, is this intended?
> Should I file a feature request to get a warning for this situation?
>
> (How I got in this situation: I did an overly eager search/replace that
> caused the duplicate ~x)
>
> Best regards,
> --Edwin
>
> --
> 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
>
[-- Attachment #2: Type: text/html, Size: 1819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] duplicate labels
2013-09-17 13:09 ` Gabriel Scherer
@ 2013-09-17 13:49 ` Török Edwin
2013-09-19 9:29 ` Goswin von Brederlow
0 siblings, 1 reply; 6+ messages in thread
From: Török Edwin @ 2013-09-17 13:49 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] duplicate labels
2013-09-17 13:49 ` Török Edwin
@ 2013-09-19 9:29 ` Goswin von Brederlow
2013-09-19 10:39 ` Lukasz Stafiniak
0 siblings, 1 reply; 6+ messages in thread
From: Goswin von Brederlow @ 2013-09-19 9:29 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] duplicate labels
2013-09-19 9:29 ` Goswin von Brederlow
@ 2013-09-19 10:39 ` Lukasz Stafiniak
0 siblings, 0 replies; 6+ messages in thread
From: Lukasz Stafiniak @ 2013-09-19 10:39 UTC (permalink / raw)
To: Goswin von Brederlow; +Cc: Caml
[-- Attachment #1: Type: text/plain, Size: 595 bytes --]
On Thu, Sep 19, 2013 at 11:29 AM, Goswin von Brederlow <goswin-v-b@web.de>wrote:
>
> 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.
>
> I believe it is not a type system-level feature wish, but a syntax of
definition-level feature wish.
[-- Attachment #2: Type: text/html, Size: 971 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-09-19 10:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-17 12:55 [Caml-list] duplicate labels 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
2013-09-19 10:39 ` Lukasz Stafiniak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox