Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by chris_7 on Sunday September 04, 2016 @10:34PM
(#12427785)
nil is just shorthand for Optional.None, which is Just Another Value. (sort of, really you can make nil translate to any type, but please don't)
[ Parent
| on HN ]
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by valleyer on Sunday September 04, 2016 @10:36PM
(#12427790)
Fair but I don't think the original claim was intended that pedantically! :)
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by masklinn on Monday September 05, 2016 @03:44AM
(#12428749)
The point of the original claim was that modern language (like Swift or Rust) tend not to make null part of every (reference) type. That Swift has a shorthand for Optional.None doesn't change that, nil isn't a valid value for e.g. a String (as it would be in Java or Go), only for String? (which is a shorthand for Optional<String>)
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by esrauch on Monday September 05, 2016 @01:14PM
(#12431287)
What you are describing is no different than modern Java where variables are marked @Nullable and its a compiler or linter error to dereference it without being inside a null-check conditional. If you don't use this in Java it is just the same as having String? as your type everywhere.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by masklinn on Monday September 05, 2016 @04:34PM
(#12432104)
> What you are describing is no different than modern Java
It is in fact quite different. String/String? is not an optional annotation requiring the use of a linter and integration within an entire ecosystem which mostly doesn't use or care for it, it's a core part of the language's type system.
> If you don't use this in Java it is just the same as having String? as your type everywhere.
Except using String? everywhere is less convenient than using String everywhere, whereas not using @Nullable and a linter is much easier than doing so.,