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

Non-mutating Datetime fns take a pointer to self #10

Closed
hazeycode opened this issue Jan 26, 2022 · 4 comments
Closed

Non-mutating Datetime fns take a pointer to self #10

hazeycode opened this issue Jan 26, 2022 · 4 comments

Comments

@hazeycode
Copy link
Contributor

hazeycode commented Jan 26, 2022

Member fns of Datetime take pointer type as self but do no mutation. This forces all instances to be declared var and does not allow const Datetime's.

These fns should just take a value type, there's virtually no benefit to passing a pointer to self in these cases; since the size of Datetime is very small, and in many cases the compiler can inline the fns anyway.

Datetime.Delta.totalSeconds,
Dateime.formatHttp,
Datetime.formatHttpBuf

@frmdstryr
Copy link
Owner

Thanks for the report! Updated now. If you see anything else let me know.

@hazeycode
Copy link
Contributor Author

Wow, that was quick @frmdstryr ! I was going to open a PR, but thanks!

@hazeycode
Copy link
Contributor Author

super-minor: maybe the README example should be updated to inline with this change

@hazeycode
Copy link
Contributor Author

Nice

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

2 participants