-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Doc base macros #27949
Doc base macros #27949
Conversation
A while ago I bookmarked these comments; perhaps they could be useful:
Stefan Karpinski on 29 June 2015:
(Note the bold emphasis I added above, which seems relevant to this PR.) |
thanks @waldyrious for the link! We can use the opportunity to document |
cc @JeffBezanson @StefanKarpinski if one of you can check if the description of |
base/irrationals.jl
Outdated
@irrational(sym, val, def) | ||
|
||
Provides a pre-computed value `val` for an irrational constant | ||
identified by `sum`, along with its definition `def`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would explain this as:
Define a new
Irrational
value,sym
, with pre-computedFloat64
valueval
, and
arbitrary-precision definition in terms ofBigFloat
s given be the expressiondef
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don’t think this explanation of @pure
is correct. The arguments can be mutable but the result cannot depend on the mutable contents. Returning the object_id
of an object should be pure, for example. The ===
function is also pure. Of course, there’s not that many useful functions of mutable objects that are pure but this explanation is still not quite right.
Ok this will be quicker to find the right doc directly from this thread:
A pure function can only depend on immutable information. Would that be ok? |
just re-merged master, some CI tests seemed not to pass anymore |
same thing, circleci didn't pass so I merged the latest master |
All checks passed. @StefanKarpinski given that you gave the last feedback, can you look at the new |
Thanks for the documentation improvements and sorry for the drawn out review process! |
no trouble, there were more touchy and critical PRs on the stack :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, github is telling me that apparently I had left some comments, but never submitted them 😬
# evaluate p[1] + x * (p[2] + x * (....)), i.e. a polynomial via Horner's rule | ||
""" | ||
@horner(x, p...) | ||
Evaluate p[1] + x * (p[2] + x * (....)), i.e. a polynomial via Horner's rule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have one blank line, and be be left-justified
|
||
`@pure` gives the compiler a hint for the definition of a pure function, | ||
helping for type inference. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a statement that "This is intended only for internal compiler use, and may change or disappear without warning".
@vtjnash I'll make another PR for these |
A simple PR adding missing documentation to some macros.
Some I couln't find anything to document (or couldn't get the code), like
@irrational
.