Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Voxera115855yThen I assume you either are using a language without the concept of null, like assembly, or you are very careful and avoid any builtin or 3’rd party methods that return null as the only indication of status.
Could probably be done but I see it would hamper a program.
And lang that just renames null to nil or nothing is still null ;) -
Do you have issues with null values?
Cause that sounds a lot like a person I know that has issues with null values. You really shouldn't.
Null has it's uses. -
Don't need to check for NPEs in your code if you barely have any to begin with.
*BIG BRAIN* -
john-doe9405yNo one got it yet.
Big projects.
I use a language with the concept of null.
I don't avoid apis that return null.
The language I use , uses null, not nil. -
@galileopy There are a number of possibilities:
1) checking error codes instead of null
2) checking error states along C's errno hack
3) ensuring that no error can happen before doing the operation plus not doing operations where that would open a race condition
4) crossing fingers and getting promoted before the shit hits the fan. -
john-doe9405yThere's another way.
Abstract the null checking in a ADT.
Call it Maybe.
Try to mimic the Maybe monad from Haskell.
Use that.
Wrap null returning functions with. Maybe.fromNullable
...
???
Profit -
Wrapping the check doesn't qualify as not doing the check. It does qualify as clickbait however.
-
john-doe9405y@Fast-Nop
I never write
if (a === null)
I never have to worry about not planning for all possible outcomes.
Or have to emulate complex execution trees on my mind while coding.
I never said it was a hard trick.
I don't check for nulls and I don't have null caused exceptions.
random