Front page | perl.perl6.language |
Postings from February 2003
Re: Shortcut: ?=
From: Deborah Ariel Pickett
February 3, 2003 16:41
Re: Shortcut: ?=
Message ID: 200302040041.h140fAqY029479@bruce.csse.monash.edu.au
> > I guess what I'm saying is that someone needs to provide a real-world,
> > non-contrived, example showing ??= in use.
> Fair enough. Real World, Non-Contrived: In all databases that I've ever
> worked with there are exactly two possible values for a boolean database
> field. Those two values are usually 't' and 'f', though in my designs I
> prefer to use '1' and '0', to keep things more perlish.
> Now, when a value comes in from a web page, it might be anything. In
> particular a checkbox is going to be either undef (if the checkbox wasn't
> checked, the standard is that the field isn't sent at all) or whatever the
> <INPUT> tag's VALUE attribute is set to, or 'on' (if VALUE isn't set).
> There is simply no way to directly get 'f' or 0 from the HTTP request, and
> 't' requires extra work. Ergo, it's necessary to massage the data a
> little to fit it into 't' and 'f'.
> In short, although Perl is quite robust about what's "true" and "false",
> other computer systems are more fussy. I personally find myself
> explicitly setting variables to 1 or 0 quite frequently, and I always use
> ?:. It would be a nice little shorthand addition to have ??= in Perl6.
All right, I'm prepared to buy that argument. (Though I probably still
wouldn't ever use the operator personally.)
I presume you'll summarize this thread to the new area you announced
today, since it seems that there aren't any strong objections. You
should address these issues too, just to make it complete:
- operator precedence and associativity
- issues with typed variables
- how it works with aggregates like arrays and hashes
- whether there's a penguin^H^H^H^H^H^H^Hguillemo^Het hyper-op version
of this, and how it looks (e.g., is the :: also bracketed?) and works.
Some of these could be palmed off by saying "The same as ?? ::", but we
may as well be complete.
Debbie Pickett http://www.csse.monash.edu.au/~debbiep firstname.lastname@example.org
"You gotta bat your eyes - like this." - _The Little Mermaid_