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

Tests for more Clojure tags #4126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aartaka
Copy link

@aartaka aartaka commented Nov 21, 2024

Hi! Here's some Clojure tests for #4123. That's not all, but it's the most frequently used things—vars and multimethods.

@masatake
Copy link
Member

masatake commented Dec 3, 2024

Thank you for making this pull request. I will merge this with some revising.

[& _]
nil)

(defmethod test :test2 named-method
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this line?
I wonder why named-method should be extracted because my knowledge of Clojure is limited.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a method-specific name that's added to multimethod function name. See https://clojuredocs.org/clojure.core/defmethod#example-542692c7c026201cdc3269cd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need help understanding.
Can named-method be used with a function?
I guess, with the name, a user can call the method by passing multi-method-dispatching. If my guessing is correct,I think 'named-method' should be tagged as a function, not a method.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it doesn't work as a self-sufficient function. It's merely a piece of metadata identifying the method. It's only useful in debugging and (given ctags support) in location search.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thank you. We should introduce a new kind for such a language object. What do Clojure hackers call it? I think of method-identifier/i or method-id/i.

The ideal tags for named-method looks like:

named-method	input.clj	/^(defmethod test :test2 named-method$/;"	i	multimethod.test	method:test
test	input.clj	/^(defmethod test :test2 named-method$/;"	m	multimethod.test	identifier:named-method

Anyway, the current Clojure parser cannot extract caddr.
So, to satisfy these new test cases, we must rewrite the parser.

@masatake masatake added this to the 6.2 milestone Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants