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

Some obscurities #47

Open
p-b-west opened this issue May 24, 2014 · 1 comment
Open

Some obscurities #47

p-b-west opened this issue May 24, 2014 · 1 comment

Comments

@p-b-west
Copy link

This snippet on exceptions is obscure. How, exactly, does :default work as a catch-all here, and does it have wider application? I know it is used in multi-methods, but have not found any other references to it.

;; JavaScript unfortunately allows you to throw anything. You can handle
;; this in ClojureScript with the following.

(try
  (throw (js/Error. "Oops"))
  (catch :default e
    e))

I have had to track down the following syntax once before, and I think it deserves more explanation.

;; We can use property access with `set!` to change the fill color of a
;; a canvas rendering context.

(set! (.-fillColor ctxt) "#ffffff")

I'm talking about the .-fillColor.

@p-b-west
Copy link
Author

I found the discussion of property access syntax near the end of the tutorial. Just a note referring readers to that discussion would do the trick, I think.

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