you are viewing a single comment's thread
view the rest of the comments
[–] 65 points 1 year ago (13 children)

Empty string used to be like my own version of null pointer.

  • source
  • hideshow 13 child comments
  • [–] 30 points 1 year ago (10 children)

    Dark times…

    Like -1 for an Int nil value.

  • source
  • parent
  • hideshow 10 child comments
  • [–] 8 points 1 year ago (9 children)

    Which language can nil an int?

  • source
  • parent
  • hideshow 9 child comments
  • [–] 10 points 1 year ago (3 children)

    Groovy will automatically convert integers into objects, as it sees fit. And one such case is when you assign null to an integer.

    There's some more languages, which try to treat primitive types like objects, to make them more consistently usable. As I understand, nullability is a big part of the reason why it can't be solved with syntactic sugar, so presumably this would be possible in all those languages.
    If I'm not mistaken, Ruby is another one of those languages.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 1 year ago (2 children)

    Groovy is pretty wild. It's like, honey, you need me to make this a BigInteger for you? I got you honey, don't even worry about it.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 1 year ago (1 child)

    Yeah, I kind of respect the stance, because it knows what it wants to be, but I also wrap number types into a separate data type to document that maybe you shouldn't multiply a port number by the wheel count and pass that into the temperature parameter, because I want more fine-grained typing, not one-size-fits-all.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 1 year ago (3 children)
  • [–] 3 points 1 year ago (2 children)

    I believe, that would mean that any 0 is equivalent to the null pointer, since the null pointer is just memory address 0...

  • source
  • parent
  • hideshow 2 child comments