From: "Mattias Waldau" <mattias.waldau@abc.se>
To: <caml-list@inria.fr>
Subject: [Caml-list] Just wasted half-an-hour on returned curried functions
Date: Sat, 14 Apr 2001 12:40:52 +0200 [thread overview]
Message-ID: <AAEBJHFJOIPMMIILCEPBCEIICIAA.mattias.waldau@abc.se> (raw)
In-Reply-To: <lu4rvu9dhz.fsf_-_@hci.ucsd.edu>
I removed the last int-argument of a function,
but only changed at the calls and in the
body, however not in the arguments, thus I had an unused arg
called ~(idx:int), i.e.
let bar a ~(idx:int) =
{ var = a ; .... }
I created data using this function and these
(now curried) arguments were put into an array, and there is where I
got the type error. It took me 30 minutes to find the true source.
I could have found the error if I would have typed the result of the
above mentioned function either at the return value or in the let,
i.e. writing
let bar a ~(idx:int) :annotated_var =
{ var = a ; .... }
or
let x:annotated_var = ..... in
However, the compiler could have found the error for immediately by
either
1. Told me that ~(idx:int) is an unused argument
2. or, had a special syntax ( for example '=()' ) for curried values, for
example,
and by that immediately complain in the let above.
I know that alternative 2 is an absurd suggestion in the church of FPLs :-)
but I don't like wasting time. Could someone give me some example code
(except lablgtk, which is a nice but very hard to understand program)
where the majority of the returned values are functions.
/mattias
P.s. I don't understand how to get warning using ocamlc, for example in the
below code I both override methods and hide instance variables, but get no
warnings.
let foo () =
let x = 0 in
let x = 1 in
x
let foo () =
let x = 0 in
let x = 1 in
x
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-04-14 10:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-12 18:31 [Caml-list] Seg fault with -custom and 2049 lets David Fox
2001-04-13 14:01 ` David Fox
2001-04-14 10:40 ` Mattias Waldau [this message]
2001-04-17 15:04 ` Xavier Leroy
2001-04-18 23:36 ` David Fox
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=AAEBJHFJOIPMMIILCEPBCEIICIAA.mattias.waldau@abc.se \
--to=mattias.waldau@abc.se \
--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