Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ergonomic Hints #21

Open
owenRiddy opened this issue Sep 7, 2023 · 0 comments
Open

Ergonomic Hints #21

owenRiddy opened this issue Sep 7, 2023 · 0 comments

Comments

@owenRiddy
Copy link

owenRiddy commented Sep 7, 2023

It can be frustrating to work out what type signatures are available. It'd be helpful to include a list of options on errors (demo: https://github.com/owenRiddy/proxy-plus-minus/blob/main/src/proxy_plus_minus/core.clj#L122).

What this looks like using the proposed custom hinting from Issue #20 :

          (proxy+ [] TestBaseClass3
                  (trickyCase [this a b] [char java.lang.String :=> int] 8))
=>
Caused by: clojure.lang.ExceptionInfo: No matching methods {:base testclasses.TestBaseClass3, 
:name "trickyCase", 
:param-type [char java.lang.String :=> int],
 :param-type-options (["finalize" [:=> void]] ["clone" [:=> java.lang.Object]] 
["getInt" [:=> java.lang.Integer]] ["getDouble" [int double java.lang.String java.lang.Integer boolean :=> double]] 
["getString" [java.lang.String :=> java.lang.String]] ["getOtherInt" [:=> int]] 
["trickyCase" [int java.lang.String :=> int]] ["trickyCase" [java.lang.Integer java.lang.String :=> int]] 
["wait" [long int :=> void]] 
["wait" [:=> void]] ["wait" [long :=> void]] ["equals" [java.lang.Object :=> boolean]] 
["toString" [:=> java.lang.String]] ["hashCode" [:=> int]] ["getClass" [:=> java.lang.Class]]
 ["notify" [:=> void]]
 ["notifyAll" [:=> void]])}

;; Programmer thinks: 'Aha! I want ["trickyCase" [int java.lang.String :=> int]] 
;;       so I should use [int java.lang.String :=> int]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant