In writing contracts for classes I always use the ->m constructor for methods,
so this example of section 5.1 of the Reference surprises me
(define file-interface<%>
(interface () open close read-byte write-byte))
(define directory-interface<%>
(interface (file-interface<%>)
[file-list (-> (listof (is-a?/c file-interface<%>)))]
parent-directory))
It looks like -> contract constructor means the same thing except, of course,
the context is an interface definition and a class contract, so it's clear from
context that this a method and not a function.
Second question: Is the inclusion of contracts in interface definitions a new
feature? I've always written interfaces using only method names and have missed
the ability to specify the shape of the method (something more analogous to
what a Java interface does). It's entirely possible that this has been in the
Reference a long time and I just missed it. In fact, I'm continually amazed at
how much is there that I've missed.
____________________
Racket Users list:
http://lists.racket-lang.org/users