Talk:Null (computer programming)

Unknown value

I think "unknown value" aids in understanding the three-valued logic semantics in a way that "undefined value" doesn't... "A = Null" is "unknown", rather than true or false, because Null is an unknown value which may or may not be equal to A. Kobes 19:43, 25 February 2006 (UTC)[reply]

I strongly disagree. A variable whose value has been set to "NULL" isn't intended to be "unknown" - to the contrary - it's very well known - you just set it to NULL! I don't particularly like "undefined" either...but it's better by far than "unknown". SteveBaker (talk) 00:41, 24 March 2008 (UTC)[reply]
A better synonym would be "not set" or "unset", i.e., "does not have a known value". — Loadmaster (talk) 02:30, 24 March 2008 (UTC)[reply]
The value of null in trinary logic is well-defined but certainly not always well used. In SQL, NULL could mean either "unknown" ("Missing but Applicable") or "not set" ("Missing but Inapplicable"), depending on its exact context. The unfortunate part about this is that such a conceptualization of NULL does not really fit into 3-logic, but 4-logic. Because of this, the SQL use of NULL is rather... deficient; see Null_(SQL)#Criticisms.
In just a straight trinary logic table, using "unknown" as a synonym works conceptually, i.e., it behaves in the way you'd expect "unknown" to behave; however, in applications that use null as a trinary value like SQL, using either "unknown" or "not set" as a synonym can seed conceptual pitfalls. 68.82.171.129 (talk) 00:38, 26 January 2009 (UTC)[reply]
In SQL, there is a further problem with presenting NULL fields (e.g., date/time fields) in sorted lists. In some cases NULL should sort before non-NULL values, while in other cases it should sort after them. | Loadmaster (talk) 03:35, 27 January 2009 (UTC)[reply]

Null strings

What are these sentences supposed to mean? Could someone give an example? The null string is not the same as the content of a string variable set to a null value. Null strings do not create 3-valued logic, in contrast to null values in strings. If you are referring to, for example, Java, when you say String s = null, that sets the reference s to null. There is no String object. -- Schapel (talk) 22:14, 13 March 2010 (UTC)[reply]

The sentences have been changed to something that seems more reasonable. However, the sentence Null strings do not create 3-valued logic seems wrong. a.equals(b) can be true, false, or result in a NullPointerException in Java, depending on the value of a in Java. That's not exactly the same as 3-valued logic, but there are 3 different results. -- Schapel (talk) 22:54, 13 March 2010 (UTC)[reply]
I am thinking more about strings in a database. A string field can contain a null string or have the null value. A null string is perfectly defined and does not give rise to 3-valued logic, being equal to only itself and unequal to any other string. A null value in a string field S makes the value undefined: the comparisons S = any string and S <> any string are both false. −Woodstone (talk) 04:20, 14 March 2010 (UTC)[reply]

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.