26
cjbatz
8y

To the people that create compilers.
Is it so goddam hard to tell me which fucking object is Null?

Comments
  • 1
    It's not hard, it's impossible! If it's null, it means that there is no object. There is no such thing as "an object that is null"
  • 1
    @willol I beg to differ :)
    If my code says use the object 'ObjSomething' and ObjSomething is null, the compiler should know that I'm asking for ObjSomething and then tell me that ObjSomething is Null. I don't need it to tell me what type of object ObjSomething is, only which object it was trying to use when the null error occurred.
  • 1
    @cjbatz "ObjSomething" is just a name for humans, it doesn't exist once the code is compiled in machine code! You just have chunks of memory

    Implementing a system to keep track of each variable in the original source code would very hard, and costly at runtime :)
  • 1
    @willol Thanks, at least now I know why
  • 1
    When asked if there was something that C# could do, but F# could not, one of the F# heavy weights (I think it was Petricek) answered "Null pointer exceptions!".

    (Of course, you can force F# to have null pointers because of C# and C++ interoperability, but in idiomatic F# or Haskell, there are no such things as null values.)
  • 0
    Propper debugging is very important to save valuable time
  • 1
    @mocrosoft I hope you meant unit testing? Debugging doesn't save time, it's time you have to spend because of the mistakes that unit tests could have saved you from.
  • 5
    Its hard and damn you should appreciate people who build Compilers.They are the guys who have to deal with shitty code.
  • 0
    Use PHP. No more compiling 😄
  • 0
    Yep it's fucking hard, even the compiler doesn't know what object it is dealing with. It just knows you asked for something at some part of the memory that was not there.
  • 0
    @aswinmohanme ...because the compiler runs at compile time (duh...) when there are no instantiated objects at all, whereas the problem the OP has is a runtime problem

    Runtime != compile time.
  • 0
    Emm isn't that your job as a programmer?
  • 1
    Update : Big up respect to the Visual Studio 2017 team for Exception Helper that tells you which object is null!
Add Comment