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

add UFCS/MCS cast, and addrCast #28

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented Oct 13, 2020

MCS cast

I use it a lot in my code, it leads to code that's easier to read/write/edit than cast[F](expr) especially in more complex expressions; yet it's as easy to audit than builtin cast (eg when grepping for cast).

for reference, previous attempt was in std/sugar (nim-lang/Nim#8528), I'm now moving this to fusion/pointers which is a module dedicated to making unsafe code easier to handle.

example

see runnableExamples

addrCast

it's a common pattern, and std/pointers is a good fit for it
see runnableExamples

@timotheecour timotheecour changed the title add pointers.cast: allow running cast in UFCS/method call syntax chains add pointers.cast: allow running cast in UFCS/method call syntax chains Oct 13, 2020
@timotheecour timotheecour changed the title add pointers.cast: allow running cast in UFCS/method call syntax chains add UFCS/MCS cast, and addrCast Jan 16, 2021
@timotheecour timotheecour marked this pull request as ready for review January 16, 2021 06:40
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

Successfully merging this pull request may close these issues.

1 participant