Talk:Null object: Difference between revisions

m
added a section header to the 1st topic so that the table of contents (TOC) is in the correct place.
(→‎Recent change: Title was wrong.)
m (added a section header to the 1st topic so that the table of contents (TOC) is in the correct place.)
 
(7 intermediate revisions by 4 users not shown)
Line 1:
== '''C'''   and   '''C+'''   languages ==
The C anc C++ examples don't really fit the task description (and it's not possible to do so, because C and C++ don't know a generic null object). What you can have is a null ''pointer'', which is a pointer which doesn't point to any object (and that is indeed what <code>NULL</code> is for). The closest to a null object in C++ would be an empty <code>boost::optional</code> from the boost library.
 
Line 25 ⟶ 26:
 
::For a long time, the task included [http://rosettacode.org/mw/index.php?title=Null_object&oldid=125487 this sentence]: ''Note: the title of this article does not appropriately represent the task. The task is about "null"-like values in various languages, which may or may not be related to the defined-ness of variables in your language.'' This sentence implied that the title, "Undefined values/Check if a variable is defined", was wrong. I renamed the page to "Null object", a phrase from the task description. This helps languages where the [[null object]] is a ''defined'' value, like <code>nil</code> in Common Lisp, <code>f</code> in Factor, <code>None</code> in Python, or <code>nil</code> in Ruby. --[[User:Kernigh|Kernigh]] 01:13, 11 November 2011 (UTC)
 
::: Please stop changing task names and descriptions; we want to avoid accidentally making implementations of tasks wrong. Well, unless you're prepared to go through all the implementations and ''fix'' anything invalidated yourself. (Not all languages have a type system that admits nulls — i.e., a bottom to the pointer/reference type system — but where that's the case, there's typically other mechanisms for saying the broader statement of “there's nothing here”.) –[[User:Dkf|Donal Fellows]] 09:30, 11 November 2011 (UTC)
:::: as has been said above, the title was wrong, the solutions are right. i went over them, and below is a listing of the issues i found. i'd appreciate if someone could verify those findings.--[[User:EMBee|eMBee]] 13:54, 11 November 2011 (UTC)
:::::In a language where the only references are names, the name change seems insignificant (if it was wrong before, for such a language, it would have to also be wrong after). (But it's also true that many language support references and names as independent concepts.) --[[User:Rdm|Rdm]] 17:04, 11 November 2011 (UTC)
 
== solutions that need review ==
 
* Basic: missing actual code
* Javascript: testing for defined
* Maxscript: test for undefined
* MUMPS: test for defined
* PARI/GP: can't tell if this example is about null or not.
* Perl: explains undef as a value but doesn't show how to tell the difference between the variable having a value and the variable actually being undefined. if that difference is not possible then this should be explained. i suppose it's the same as Perl 6, there it is explicitly stated that null objects can not be tested for.
 
== Quip? ==
 
This task almost demands a reference to Shakespeare's [[wp:Much_Ado_About_Nothing|Much Ado About Nothing]]. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 04:44, 16 April 2014 (UTC)
 
== Delphi vs. Pascal ==
 
The entries of [[Delphi]] and [[Pascal]] in this article should be exchanged, since Pascal is the language, Delphi is one implementation, (one among others)
And since the null-object is no Delphi-specific feature.