Undefined values: Difference between revisions

(Scala contribution added.)
Line 1,277:
 
=={{header|Scala}}==
Learned from [http://catless.ncl.ac.uk/Risks/25.51.html#subj9.1 Tony Hoare's "Null References: The Billion Dollar Mistake"], Scala discourages the use of ''null'' values. For Java compatibility the value ''null'' could be used, but since it implies also a mutable ''var'' this is a bad practice.
 
Instead type wrapper ''Option'' is used which could result in ''Some(value)'' or ''None''. A Option[Boolean] e.g. reflects a tri-state (nullable) database value.
 
Notices that ''Option(value).isEmpty'' methods (on e.g. String) usually test for nullable.
 
Notices that ''.isEmpty'' methods (on e.g. String) usually test for nullable.
=={{header|Seed7}}==
Seed7 variables are initialized, when they are defined. This way a variable can never have an undefined value. There is also no general NULL value. When there is a need for a NULL value, an interface type can define its own NULL value. E.g.: The interface type [http://seed7.sourceforge.net/libraries/file.htm file] defines [http://seed7.sourceforge.net/libraries/null_file.htm#STD_NULL STD_NULL], which is used to initialize file variables and as result of [http://seed7.sourceforge.net/libraries/external_file.htm#open%28in_string,in_string%29 open], when a file cannot be opened.
Anonymous user