Re: TIP #185: Null Handling

From: David S. Cargo (escargo_at_skypoint.com)
Date: 04/15/04


Date: Wed, 14 Apr 2004 19:35:47 -0500

John H. Harris <JHHarris@valley.net> wrote:

>
> TIP #185: NULL HANDLING
This reminds me of the "null" value in Icon. The null value in Icon
is the value assigned to all identifiers initially. (One of the
interesting ways that languages differ is in how they handle the use
of an uninitialized variable. If I remember correctly, in awk an
uninitialized variable is treated as having a value of the empty
string. In perl it was either the empty string or 0, depending on
context (if I remember correctly.)

There are simple operations to test for values being null or nonnull.
However, in most cases uses of variables with null values are errors.
You can assign the null value to variables.

There gets to be language-specific distinctions between undeclared
variables, uninstantiated variables, variables with unassigned values,
and variables with empty values.

In tcl, if you unset a variable, the variable goes away, not its
value.

I probably would be more inclined to something along the lines of
Icon, where variables can have a null value, but using for anything
except for testing it for a null value is an error.

The only other context where I can see this being of use might be in
procedure calls where there might be optional parameters. With a
procedure definition like

 proc withDefaults { {a "a"} {b "b"} {c "c"} } {
    puts $a
    puts $b
    puts $c
 }

You could call this with [withDefault <null> B <null>] and get
 a
 B
 c

Code that depends on all parameters after a null parameter being null
(which seems possible, but unlikely) would have that assumption
broken.

escargo

David S. Cargo (escargo@skypoint.com)



Relevant Pages

  • Re: The trash can
    ... How does one make the trashcan appear as a desktop icon? ... looks like an empty battery indicator, ... times I selected 'Remove from Panel' when I wanted to just empty it.. ... Because 'remove from panel' has an icon with it ...
    (Ubuntu)
  • RE: XP Pro Recycle Bin is empty but still shows files icon
    ... it's just the icon that's wrong. ... Norton Protected bin. ... > (or even just after I empty the bin) the icon still shows it has files. ... > when I try to empty it again, it wants to delete my Windows directory. ...
    (microsoft.public.windowsxp.general)
  • Re: [kde-linux] Garbage icon
    ... Name enter whatever you like (Trash, Recicle Bin, etc.) and in the URL box ... Creating the trash that way does work, but the icon does not change ... full-trashcan icon (although it's empty), and changing it to an empty trash, ... Comment=Contains removed files ...
    (KDE)
  • "Tilde" File Mysteriously Appears on Desktop
    ... Whenever I send an email from Outlook Express a mysterious ... file (it's empty) that's represented by an open page icon ... with a tilde inside suddenly and mysteriously appears on ...
    (microsoft.public.windowsxp.general)
  • Re: Recycle Bin
    ... >icon still indicates items remaining although Explorer shows it as empty. ... >file/folder named Windows is available to be deleted. ... Best way to deal with recycle bin probs is to delete it in safe mode, ...
    (microsoft.public.windowsxp.help_and_support)