[racket] Contracts in interfaces
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120924/9118de4a/attachment-0001.html>