News for hackers. Stuff that matters.
Re:Law of Demeter and immutability by lomnakkus on Friday September 30, 2016 @12:58PM (#12613646)
That doesn't really solve the problem. What if "x" is a nullable type (i.e. not a primitive type)?
Re:Law of Demeter and immutability by recursive on Friday September 30, 2016 @01:36PM (#12613888)
The nulls get coalesced. In what way is it not solved?
Re:Law of Demeter and immutability by lomnakkus on Friday September 30, 2016 @01:53PM (#12614040)
"x" could be of a nullable type.
Re:Law of Demeter and immutability by recursive on Friday September 30, 2016 @03:22PM (#12614647)
And the result of the entire expression is still nullable. I'm not seeing any problem.
Re:Law of Demeter and immutability by lomnakkus on Friday September 30, 2016 @04:01PM (#12614903)
Hm. What do you think "42 + null" is?
Re:Law of Demeter and immutability by recursive on Friday September 30, 2016 @05:41PM (#12615430)
According to c# (the language I'm talking about) I think it's null. That seems correct to me. Arithmetic on null operands logically seems to have a null result to me. I'm not sure what you're getting at.

https://dotnetfiddle.net/nQoEKu

Re:Law of Demeter and immutability by lomnakkus on Saturday October 01, 2016 @08:30AM (#12617585)
That's OK, I.. guess. I don't think I should even be allowed to ask the question because it's an absurd question[1]. Does that position make sense to you?

[1] Not for frivolous reasons. It's almost always nonsensical to ask this type of question with "null" values. For the sensical cases we have Maybe/Option.

Re:Law of Demeter and immutability by recursive on Saturday October 01, 2016 @10:20AM (#12617947)
I think I see what you want now. In order to get the value out, you'd have to use pattern matching or a type guard or something, inside of which you'd know there was a value.

That makes sense to me too. But compared to Maybe, a null-safe member accessing operator, along with null-lifted operators seems nearly as good from my point of view.