From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 2B9E981792 for ; Wed, 10 Jul 2013 17:02:53 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jfc@MIT.EDU) identity=pra; client-ip=18.7.68.36; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jfc@mit.edu"; x-sender="jfc@MIT.EDU"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jfc@mit.edu designates 18.7.68.36 as permitted sender) identity=mailfrom; client-ip=18.7.68.36; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jfc@mit.edu"; x-sender="jfc@mit.edu"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@dmz-mailsec-scanner-7.mit.edu) identity=helo; client-ip=18.7.68.36; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jfc@mit.edu"; x-sender="postmaster@dmz-mailsec-scanner-7.mit.edu"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao0BAJB23VESB0QknGdsb2JhbABagzuvPZIggRMWDgEBAQEBCAsJCRQogiMBAQQBJ0cLEAsOEwQhDzYSBiWHawMJCQmwcANViAaPYweDdQOZAJNO X-IPAS-Result: Ao0BAJB23VESB0QknGdsb2JhbABagzuvPZIggRMWDgEBAQEBCAsJCRQogiMBAQQBJ0cLEAsOEwQhDzYSBiWHawMJCQmwcANViAaPYweDdQOZAJNO X-IronPort-AV: E=Sophos;i="4.87,1036,1363129200"; d="scan'208";a="25446067" Received: from dmz-mailsec-scanner-7.mit.edu ([18.7.68.36]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Jul 2013 17:02:52 +0200 X-AuditID: 12074424-b7f228e00000096b-f1-51dd779b269d Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id 8E.0A.02411.B977DD15; Wed, 10 Jul 2013 11:02:51 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r6AF2ogb012188; Wed, 10 Jul 2013 11:02:51 -0400 Received: from localhost (contents-vnder-pressvre.mit.edu [18.9.64.11]) (authenticated bits=0) (User authenticated as jfc@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r6AF2mcZ007014; Wed, 10 Jul 2013 11:02:48 -0400 Message-Id: <201307101502.r6AF2mcZ007014@outgoing.mit.edu> To: Ivan Gotovchits cc: caml-list@inria.fr In-reply-to: <878v1ea5ky.fsf@golf.niidar.ru> References: <878v1ea5ky.fsf@golf.niidar.ru> Comments: In-reply-to Ivan Gotovchits message dated "Wed, 10 Jul 2013 17:48:45 +0400." X-Mailer: MH-E 8.2; nmh 1.3; GNU Emacs 23.3.1 Date: Wed, 10 Jul 2013 11:02:47 -0400 From: John Carr X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrDu7/G6gwbvPmhafdmxgsVgy8SWj A5PH0wkHmTwmvTjEEsAUxWWTkpqTWZZapG+XwJUxoXsha8EE7oqea0cYGxgPcXQxcnJICJhI HN6/nA3CFpO4cG89kM3FISSwj1Hi7/znjBDORkaJU29XQWV+MUrcf7iFHaSFV8BKYu2CJqAq Dg4RASWJOftlQMLMQJNePXwAViIs4CSx7fchMJtTQEeia9ZeNpByIQFtic07wExmgUyJ9m2i EDfoSvzbv4YFJMwioCqx4pA5SJhNQFbiUXsX4wRG/gWMDKsYZVNyq3RzEzNzilOTdYuTE/Py Uot0zfVyM0v0UlNKNzGCQojdRWUHY/MhpUOMAhyMSjy8DfF3A4VYE8uKK3MPMUpyMCmJ8haX AYX4kvJTKjMSizPii0pzUosPMUpwMCuJ8KpbAeV4UxIrq1KL8mFS0hwsSuK8z56eDRQSSE8s Sc1OTS1ILYLJynBwKEnw2oIMFSxKTU+tSMvMKUFIM3FwggznARreAlLDW1yQmFucmQ6RP8Wo y/Gvu6eLUYglLz8vVUqcdwZIkQBIUUZpHtwcWOy/YhQHekuYdzJIFQ8wbcBNegW0hAloyZ6U OyBLShIRUlINjHxZx554xIgr1eW8kkkJvTxzjVhFVa6OeyxPRm6kSlWEgFuy85SKw8ZyhvPa tL2r1x7Yfueq/vPEzo8Zz6+/PWknxb5ZbRO/J5th0xwexdhtkUmL9lVpf5V++cB7ftzDdPfS 2itq1heUdJvsOQyEXc2CPDrdV4Q/OL2JgWPFz7mq5f+vOd9WYinOSDTUYi4qTgQAoT8GftgC AAA= Subject: Re: [Caml-list] Applying labeled function without a label A function with an unconstrained type variable on the right hand side of its type can potentially take an unlimited number of arguments. You have the equivalent of a shift-reduce conflict in a grammar. The compiler can choose to reduce (apply f to the argument) or shift (save the arguments waiting for more). The choice to shift seems odd but there may be a situation where it is useful. If your function were defined let f ~a = a + 0 it would be monomorphic. The compiler would match an unlabeled argument with parameter a. > > > Please, can someone explain the reason behind the following behaviour: > > > # let f ~a = a;; > val f : a:'a -> 'a = > > if I apply function f, omiting the label, instead of an error I'll get: > > # f 12;; > - : a:(int -> 'a) -> 'a = > > ... a function that accepts a labeled arguments, that is a function from int > to 'a, and returns a result of this function: > > # f 12 ~a:(fun x -> x + 1);; > - : int = 13 > > and even more, if I apply it to more unlabled arguments: > > # f 1 2 3 4 5;; > - : a:(int -> int -> int -> int -> int -> 'a) -> 'a = > > It is very confusing... > > -- > 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