News for hackers. Stuff that matters.
Re:Greppability is an underrated code metric by WalterBright on Tuesday September 03, 2024 @02:58AM (#41432071)
I regard every cast as a bug in my own code and try to refactor it so there aren't any. I can't get rid of all of them, but they're always worth a second look.

I don't normally grep for them, but others have told me they did.

P.S. one thing about D is you can do things like this:

    ubyte b = i;            // error, losing bits
    ubyte b = cast(ubyte)i; // ugly cast
    ubyte b = i & 0xFF;     // no cast, no error!
It's just one of the nice little details that making programming in D a pleasure.
Re:Greppability is an underrated code metric by Too on Wednesday September 04, 2024 @01:08AM (#41442113)
These things are better checked automatically with a static linter, that presumably already has a full parser and AST representation of the language and knows what is a cast and not.

Nobody should keep a checklist of "100 things to grep for when doing a code review".