Undefined values: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Remove nyi, speculative type smiley example) |
(Scala contribution added.) |
||
Line 1,276: | Line 1,276: | ||
</pre> |
</pre> |
||
=={{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 could be used, but this a bad practice. |
|||
Notices that ''.isEmpty'' methods (on e.g. String) usually test for nullable. |
|||
=={{header|Seed7}}== |
=={{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. |
|||
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. |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |