Implicit cast primitive type construction

ryuukk_ ryuukk.dev at gmail.com
Thu Oct 10 17:52:36 UTC 2024


I was doing this:

`cstats.stamina = cstats.stamina + 1;`


but it doesn't compile

you'd think this code compile, nope, you have to uglify your code 
with:

`cstats.stamina = cstats.stamina + cast(ubyte) 1);`

or this if you do other stuff

`cstats.stamina = cast(ubyte) (cstats.stamina + 1);`


this makes the code messier and annoying to type

what about the following then?


`cstats.stamina = cstats.stamina + ubyte(1);`


..same error message...


i don't know how any of this is called, if you know, please 
enlighten me

but it would be cool if it'd work



More information about the dip.ideas mailing list