PasteRack.org
Paste # 37859
2022-08-05 18:59:32

Fork as a new paste.

Paste viewed 1094 times.


Embed:

  1. #lang racket
  2.  
  3. (define foo%
  4.   (class* object% ()
  5.     (super-new)
  6.     (define/public (f x) x)))
  7.  
  8. ;; Change `[f any/c]` to `f` and this will work.
  9. (define interface<%> (interface () [f any/c]))
  10. (class* foo% (interface<%>))
  11.  
  12. (define obj (new foo%))
  13. (send obj f 10)

=>

#<class:eval:4:0>

application: not a procedure;

 expected a procedure that can be applied to arguments

  given: '(#<procedure:f method in foo%> ((#<flat-contract:

any/c> (interface interface<%>) (class eval:4:0) #f)))