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

Should node/coerce also be implemented for nil? #52

Closed
jespera opened this issue Nov 2, 2016 · 6 comments
Closed

Should node/coerce also be implemented for nil? #52

jespera opened this issue Nov 2, 2016 · 6 comments

Comments

@jespera
Copy link
Contributor

jespera commented Nov 2, 2016

If I call (node/coerce nil) I get an error: (I've added line-breaks in the error message)

IllegalArgumentException No implementation of method: :coerce of protocol: 
#'rewrite-clj.node.protocols/NodeCoerceable found for class: nil  
clojure.core/-cache-protocol-fn (core_deftype.clj:568)

However, calling (parser/parse-string "nil") returns a node <token: nil>

Is this behavior by design? Would it conflict with anything to extend the NodeCoerceable protocol to nil-values?

@xsc xsc added the enhancement label Nov 2, 2016
@xsc
Copy link
Contributor

xsc commented Nov 2, 2016

No, it's perfectly reasonable to implement the protocol for nil values.

@jespera
Copy link
Contributor Author

jespera commented Nov 2, 2016

Would you accept a pull-request or is it not a thing you'd want in the main code-base?

@xsc
Copy link
Contributor

xsc commented Nov 2, 2016

@jespera I'll gladly accept a PR for this! Sorry for being kinda vague in the previous comment. :)

@jespera
Copy link
Contributor Author

jespera commented Nov 2, 2016

#53

@jespera jespera closed this as completed Nov 2, 2016
@xsc
Copy link
Contributor

xsc commented Nov 2, 2016

Released as 0.6.0.

Release Notes

@jespera
Copy link
Contributor Author

jespera commented Nov 2, 2016

Very nice! Thanks a lot for the quick response. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants