-
Notifications
You must be signed in to change notification settings - Fork 12
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
Proper way to declare a const int variable? #17
Comments
Hi, thanks for opening this issue! Writing a proc macro is on my todo list for this crate, but I haven't got round to it yet. Is the value that you want to initialise a single literal or is it the result of a computation? I think in theory it should be possible to create any value using the Currently, the |
That would be awesome. In the mean time is there an example of initializing
one with one of the const methods?
…On Fri, Feb 24, 2023 at 1:19 PM Isaac Holt ***@***.***> wrote:
Hi, thanks for opening this issue! Writing a proc macro is on my todo list
for this crate, but I haven't got round to it yet. Is the value that you
want to initialise a single literal or is it the result of a computation? I
think in theory it should be possible to create any value using the const
methods defined on I512 but a macro for compile time parsing of literals
would definitely be beneficial.
Currently, the from_str method in the FromStr trait implementation is not
const but I could make a const equivalent, which would at least allow const
parsing of decimal literals, and would be fairly quick to release as a
temporary workaround.
—
Reply to this email directly, view it on GitHub
<#17 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOE4LIRDAMC4GLHBHIWY53WZD3UDANCNFSM6AAAAAAVFDJVXE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I think the simplest example would be using the
The |
And then you could use methods like |
Yes thank you! |
No worries! Good news, I have just made the |
I have just published version 0.6.0 which provides a |
I need to declare a
const MY_NUM: I512
but I can't figure out syntax that would allow me to set the value in a const context. Is there not a way to do this yet? Would be happy to write a macro for this purpose if there is any possible way to initialize one of these in a const context.The text was updated successfully, but these errors were encountered: