Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: skaller@users.sourceforge.net
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] partial application warning unreliable?
Date: Thu, 08 Dec 2005 12:10:12 +0900 (JST)	[thread overview]
Message-ID: <20051208.121012.49167263.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <1134009551.10435.24.camel@rosella>

From: skaller <skaller@users.sourceforge.net>

>     method add_nonterminal (s:string) (sr:range_srcref) (toks:
> Flx_parse.token list) (term:ast_term_t) =
> 
> ...
>     state#add_nonterminal tok (Flx_srcref.slift sr) t;
> 
> Method has 4 arguments, but the call applies to only 3.
> 
> Woops, no warning!! Bad! This error of mine caused a serious
> bug -- the method call didn't do anything!

Wait a minute, is there anything after the semicolon?
The point is that a trailing semicolon at the end of a method
definition does nothing: it still returns the result of the previous
expression!
I wonder whether this behaviour is good or not, but this also means
that there is no reason to have a warning here.

If there is an expression after the semicolon, and you have no
warning, then file a bug report: the type system is supposed to detect
all partial applications in statements, except for functions whose
result is a polymorphic type variable.

By the way, your other example with classes is wrong:

# class cc = object (self) 
    method f x y = x + y 
    method g () = self#f 1;  
  end;;
class cc :
  object method f : int -> int -> int method g : unit -> int -> int end

No warning, for the reason stated above: the semicolon does nothing.

Jacques Garrigue


  reply	other threads:[~2005-12-08  3:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08  2:39 skaller
2005-12-08  3:10 ` Jacques Garrigue [this message]
2005-12-08  7:11   ` [Caml-list] " skaller
2005-12-08 14:41     ` Damien Doligez
2005-12-08 23:51   ` malc
2005-12-09  1:43     ` skaller
2005-12-09  2:15       ` Jacques Garrigue
2005-12-09  2:56         ` skaller
2005-12-09 15:26         ` malc
2005-12-10  0:49           ` Jacques Garrigue
2005-12-10  1:40             ` malc
2005-12-09 12:21       ` Andreas Rossberg
2005-12-09 17:17         ` skaller
2005-12-09 17:52           ` Andrej Bauer
2005-12-09 18:54           ` Andreas Rossberg

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=20051208.121012.49167263.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@yquem.inria.fr \
    --cc=skaller@users.sourceforge.net \
    /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