user972946
user972946

Reputation:

Can I hint a function's parameter type in deftype?

I attempted to do:

(defprotocol TestP
  (fun [this ^int i]))

(deftype Test [] TestP
  (fun [this ^int i] i))

However, compilation fails and says Can't find matching method: fun. Does that mean deftype functions may not accept type hints on parameters?

Upvotes: 2

Views: 323

Answers (1)

Ankur
Ankur

Reputation: 33637

You don't need to specify the type hint in deftype as the error message clearly states:

Can't find matching method: fun, leave off hints for auto match.

Upvotes: 2

Related Questions