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

Aliases in protocol functions should work? #440

Closed
borkdude opened this issue Nov 10, 2020 · 0 comments
Closed

Aliases in protocol functions should work? #440

borkdude opened this issue Nov 10, 2020 · 0 comments

Comments

@borkdude
Copy link
Collaborator

borkdude commented Nov 10, 2020

(ns foo) (defprotocol Foo (foo [this]))
(ns bar (:require [foo :as f]))

(extend-type String
  f/Foo
  (f/foo [this] (subs this 0 1)))

(f/foo "foo") ;;=> "f" 

Note that Clojure totally ignores the alias:

(extend-type String
  f/Foo
  (foobarf/foo [this] (subs this 0 1)))

also works.

It seems CLJS only supports this if the namespace really exists.

@borkdude borkdude changed the title Aliases in protocol functions should work Aliases in protocol functions should work? Nov 10, 2020
borkdude added a commit to babashka/babashka that referenced this issue Nov 10, 2020
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