The cast(signed), cast(unsigned) feature proposal

Adam D. Ruppe destructionator at gmail.com
Fri Jun 7 14:00:11 PDT 2013


On Friday, 7 June 2013 at 20:52:53 UTC, Mrzlga wrote:
> - Use the library for it and instead make signed(x), 
> unsigned(x) templates.

I think this is a really strong counterargument and one I'd like 
to see done, along with other kinds of casts in the library.

>     > Downsides to this solution: User can't easily grep for 
> 'cast' and find the 'unsigned(x)' template. It should be 
> consistently greppable in the exact same way as other casts. 
> Because it is a cast, so don't hide it.

I would name it cast_to_unsigned or signed_cast or something like 
that. Then the word "cast" is still there.

Most of phobos uses camelCase so underscores might be weird, but 
it is a cast, it is supposed to be a little weird, and besides, I 
can't get C++'s various_casts out of my mind.


More information about the Digitalmars-d mailing list