> Working with CGI forms and databases, it's something of a pain
> having to do
> 
>    string = cgi['field'][0]
> 
>    if string.nil? || string.empty?
>       error "Please specify a value for 'field'"
>    end
> 
>    etc etc...
> 
> Would it be silly to have a predefined method:
> 
>    def nil.empty?
>       true
>    end

Funny you should ask.  I've been holding onto said patch for a
while. What you ask/describe is a god-send for web developers, IMHO.
Please let me know if you submit an RCR so I can vote.  A patch for
described behavior is attached.

/me chanting: "Go Dave, Go Dave, Go Dave!"

:~)  -sc

-- 
Sean Chittenden
Index: object.c
===================================================================
RCS file: /src/ruby/object.c,v
retrieving revision 1.81
diff -u -r1.81 object.c
--- object.c	2002/07/02 09:58:13	1.81
+++ object.c	2002/07/07 03:27:08
@@ -333,6 +333,13 @@
 }
 
 static VALUE
+nil_empty_q(obj)
+    VALUE obj;
+{
+    return(Qtrue);
+}
+
+static VALUE
 nil_to_i(obj)
     VALUE obj;
 {
@@ -1302,6 +1309,7 @@
     rb_define_global_function("Array", rb_f_array, 1);
 
     rb_cNilClass = rb_define_class("NilClass", rb_cObject);
+    rb_define_method(rb_cNilClass, "empty?", nil_empty_q, 0);
     rb_define_method(rb_cNilClass, "to_i", nil_to_i, 0);
     rb_define_method(rb_cNilClass, "to_f", nil_to_f, 0);
     rb_define_method(rb_cNilClass, "to_s", nil_to_s, 0);