13

Feel free to make fun of me on this one.

> be me.
> Write a function that calls a second function to get a returned value and continue work.
> That second function always returns null no matter what changes are made.
> Spend half hour scratching head.
> That second function has this written at the end

return null;
//return $returnVal;

> fml.

Comments
  • 1
    I always feel free to make fun of you and your elephant :)
  • 2
    That looks like PHP. I'm impressed you managed to find the problem so quickly.
  • 2
    more naps, clearly
  • 1
    Seriously?! WTF?! Are you human or something?! I am sure there are Vortigons somewhere that would laugh. Humans on the other hand recognize doing stupid shit.
  • 3
    Happens to the best.
  • 2
    If you think you’ve fucked up you’ll be pleased to know how I fucked up-as I was adding typescript to the codebase (it’s early build so not a huge refactoring job) i saw the css wasn’t working properly so I spent hours thinking typescript fucked it up for some reason then realized I forgot to import the css into the react components…..🤪😳😳😳🤯

    I’m the worlds stupidest dev
  • 0
    But what's the purpose of second function returning null though?

    Can't imagine a scenario where this is necessary.

    Did you set it for testing/debugging and forgot to remove it?
  • 1
    @cho-uc exactly. I put it there myself and forgot that I did it.
  • 1
    I was about to berate dynamically typed languages, but then I remembered that I encountered 4 instances of this exact bug last week in C#
  • 0
    @lorentz yes, because this "bug" has nothing to do with dynamic typing ^^
  • 1
    @Lensflare Well, apart from pushing unfinished code, it mostly has to do with being able to return a value outside the set of values explicitly supported by the return type, only it's not because all functions return all types but because null is added to the values supported by reference types.
  • 1
    @lorentz right. There was too few context to see if the returned null was legitimate. I assumed that it was just about the forgotten comment :)
  • 1
    @Lensflare I read it like a return statement that doesn't work so it's temporarily commented out and a placeholder statement added just to get the code to compile so other parts (hopefully required for the return statement) can be developed before finishing the half-done function
Add Comment