maria icon indicating copy to clipboard operation
maria copied to clipboard

Can't `doc` functions in `Math`

Open daveliepmann opened this issue 7 years ago • 6 comments

Issue:

(doc Math/sin) returns

Could not resolve the symbol Math/sin. Maybe it has not been defined?

daveliepmann avatar Mar 05 '18 16:03 daveliepmann

Interesting, I did not even know that Math is a special namespace: https://cljs.github.io/api/syntax/Math-namespace

I don't think there are 'vars' associated with these special namespaces. I suppose we could import docstrings from https://www.w3schools.com/js/js_math.asp? or https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math (depending on their licenses), or write our own. We could also do this for other stuff in the js/ namespace which we know to be available in most/all browsers. an easy onramp to the most-likely-to-be-needed javascript/browser functions..

mhuebert avatar Mar 05 '18 16:03 mhuebert

MDN, which I generally prefer, is CC-BY-SA licensed: https://developer.mozilla.org/en-US/docs/MDN/About#Copyrights_and_licenses

daveliepmann avatar Mar 05 '18 18:03 daveliepmann

We should make sure to override our usual clojuredocs link with a link to https://cljs.github.io/api/syntax/Math-namespace.

daveliepmann avatar Mar 05 '18 18:03 daveliepmann

Would we want to provide non "special namespaced" versions of the common functions to make the experience more uniform for learners?

jackrusher avatar Mar 06 '18 07:03 jackrusher

I think we could take the "pretend-to-be-a-var" pathway that already exists for repl-specials, and extend it for Math. That would have the advantage of only being a tooling augmentation, and keep user code portable (without dependencies).

On Tue, Mar 6, 2018 at 8:40 AM, Jack Rusher [email protected] wrote:

Would we want to provide non "special namespaced" versions of the common functions to make the experience more uniform for learners?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mhuebert/maria/issues/187#issuecomment-370691261, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKFZ7Qgc7jKm7uxfkxTRaDOdacLkbrCks5tbj1sgaJpZM4Sclzg .

-- http://matt.is — Berlin, Germany

mhuebert avatar Mar 06 '18 09:03 mhuebert

I'm torn. Math functions are almost a good time to introduce the concepts of namespaces and JavaScript...but they feel too soon. So yeah, I agree we should pretend to be a var, and in the source for those specials we point to CLJS.github.io and MDN.

daveliepmann avatar Mar 06 '18 09:03 daveliepmann