-
-
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
Assume :foldable
in isuppercase
/islowercase
for Char
#54346
Conversation
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.
Looks good to me. Thanks!
Annotate `@ccall` macro Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>
Annotate `@ccall` macro in `isuppercase` Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>
Should similar changes me made elsewhere as well, e.g. in |
If you're motivated, that would be helpful. Having said that I don't believe it's necessary for merging this PR. |
Following on from #54346, this marks the `ccall` in `category_code` as foldable. This lets us compute the results of several functions at compile time, such as: ```julia julia> @code_typed (() -> isletter('C'))() CodeInfo( 1 ─ return true ) => Bool julia> @code_typed (() -> isnumeric('C'))() CodeInfo( 1 ─ return false ) => Bool julia> @code_typed (() -> ispunct('C'))() CodeInfo( 1 ─ return false ) => Bool ```
Following on from JuliaLang#54346, this marks the `ccall` in `category_code` as foldable. This lets us compute the results of several functions at compile time, such as: ```julia julia> @code_typed (() -> isletter('C'))() CodeInfo( 1 ─ return true ) => Bool julia> @code_typed (() -> isnumeric('C'))() CodeInfo( 1 ─ return false ) => Bool julia> @code_typed (() -> ispunct('C'))() CodeInfo( 1 ─ return false ) => Bool ```
…ng#54346) With this, `isuppercase`/`islowercase` are evaluated at compile-time for `Char` arguments: ```julia julia> @code_typed (() -> isuppercase('A'))() CodeInfo( 1 ─ return true ) => Bool julia> @code_typed (() -> islowercase('A'))() CodeInfo( 1 ─ return false ) => Bool ``` This would be useful in JuliaLang#54303, where the case of the character indicates which triangular half of a matrix is filled, and may be constant-propagated downstream. --------- Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>
Following on from JuliaLang#54346, this marks the `ccall` in `category_code` as foldable. This lets us compute the results of several functions at compile time, such as: ```julia julia> @code_typed (() -> isletter('C'))() CodeInfo( 1 ─ return true ) => Bool julia> @code_typed (() -> isnumeric('C'))() CodeInfo( 1 ─ return false ) => Bool julia> @code_typed (() -> ispunct('C'))() CodeInfo( 1 ─ return false ) => Bool ```
With this,
isuppercase
/islowercase
are evaluated at compile-time forChar
arguments:This would be useful in #54303, where the case of the character indicates which triangular half of a matrix is filled, and may be constant-propagated downstream.