-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul Hodges wrote:

| --- Luke Palmer <[EMAIL PROTECTED]> wrote:
|
|>Paul Hodges writes:
|>
|>>So, in P6:
|>>
|>>  if 0     { print "0\n";     } # I assume this won't print.
|>>  if '0'   { print "'0'\n";   } # I assume this won't print.
|>>  if ''    { print "''\n";    } # I assume this won't print.
|>>  if undef { print "undef\n"; } # I assume this won't print.
|>>
|>>But my question is, will this:
|>>
|>>  if "\0" { print null\n"; } # Is this going to print, or not?
|>
|>As far as things are currently defined, yes, it will print.  And your
|>syntax is perfect... well, maybe not:
|>
|>    if undef { print "undef\n"; }
|>
|>Might be interpreted as:
|>
|>    if undef( { print "undef\n"; } ) # syntax error, expecting {
|>
|>But close enough anyway.
|
|
| Maybe I should have been more specific:
|
|   if undef() { whatever(); }
|
| But it's a moot point, since only a moron would test what he knowks the
| answer to -- unless it's one of those wierd cases, and then he could
| just use 0 instead......
|
| So, putting it back into the context of real things.....
|
|
|>If you must check for a null byte, it's as simple as:
|>
|>    unless $chr     { print "0, '', or '0' }
|>    unless ord $chr { print "null byte" }
|
|
| So a null byte is still Boolean true.
| Ugh, yarf, ack, etc.
|
| But as long as I know -- easy enough to check explicitly.
|
| But just tell me this....am I the only guy who thinks this *feels*
| wierd? Understanding the reason doesn't make it any more ~comfortable~.

I think it feels fine. The weirdness comes from the difference between
string context and numeric context I think - like with '0' being false
and '0.0' being true in string context, but if you converted them both
to numbers they'd both be false.

This is why Perl 6's explicit typing will be such a Good Thing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA2/4E0UvYjCBpIlARAor4AKCjsHZBmLqnKwDt2kMINwAS0ZMBFQCeIup3
20Jlgv0D/WQt+sRjHhGuAbQ=
=Tl+q
-----END PGP SIGNATURE-----



Reply via email to