[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Bug report on 5.14b1 (fwd)



According to Brian L. Matthews:
> Warning! Biting Sarcasm and Harsh Words ahead.
*nod* as you have said - so do I.

> |> Those two aren't even syntactically equivalent:
> |>    if($^O =~ /mac/i ) {}
> |Heh.  Syntactically or not, if $^O contains "MacOS" then
> |both of the commands will return true.  :-)
> 
> Ah. The "it happens to do what I want in one particular case, so who
> cares if it's demonstrably wrong" argument.

Ah. *BEEP* Wrong!  But thanks for playing our game!

Actually, if $^O contains "MacOS" AND if "=~" does a string
search for a particular string given the "/../" operator,
THEN

	if( $^O eq "MacOS" )

	Which does a specific string compare versus the

	if( $^O =~ /mac/i )

	Which looks for a particular string within the variable ^O

	Both of these IF statements will return true.
	Further, it would seem kind of silly to me for Perl
	(or MacPerl) to do the

	if( $^O eq "mac" )
	if( $^O eq "Mac" )
	.
	.
	.

	which was suggested before.  It makes more sense
	for the string, in the case of the "i" option to be
	converted to all uppercase or all lowercase, as
	well as the search string and then a single compare
	done to both.  Since if the test was for

	if( $^O =~ /lksajdlfkdsjfoiasflekj alksfjiealjkflkdj/ )

	it would be an astromonical set of IF statements.

> No. The real problem with the regular expression is that it's
> just plain wrong, and if you use it and your script blows up on
> some future operating system, you get what you deserve.

Nope.  Sorry.  The IBM part has always stayed IBM, the UNIX
part has always stayed UNIX.  But we have two choices
with the Mac.  The first is that the word "MacOS" will stay
as "MacOS"  This would ruin any

	if( $^O eq "MacOS" )

Statements IF, AND ONLY IF, the new Unix box Mac does not
recognize the ":" separator.  If it does - then you are
ok.  But if it doesn't, then everyone is hosed.

The second is that we will wind up with "MacOS" for the Mac
interface and "Unix" for the OpenStep interface.  In this
case everyone's (including my own) tests against $^O will
be ok.

Now, as for regular expressions being just plain wrong -
that's just silly talk.  I use the

	if( X =~ /y/i )

thing all the time.  When searching databases I use it to
return all records which contain a given expression.  Such
as:  /12*0/ to look for all records which contain "1",
possibly one or more "2"'s, and a "0".  I think it is one
of the best features about Perl.  Although there are MANY
good features about Perl.  But being able to just put in a
partial string and look through the database quickly for
that string is a godsend.  What with having to deal with
engineers, doctors, managers, and the like.  People love
being able to just put in part of what they are looking for
and have the computer do the rest.  Then all they have to
do is just pick out which one they want from a list and
they are off and running.

Heck, if Perl didn't have the ability to do this life would
be much harder.  I think you should rethink things here a
bit.  Or do you enjoy having to do the:

	if( $dopeyPersonPutThisIn eq "xerox" ){
		}
		elsif( $dopeyPersonPutThisIn eq "Xerox" ){
		}
		elsif( $dopeyPersonPutThisIn eq "xErox" ){
		}
		elsif( $dopeyPersonPutThisIn eq "xeRox" ){
		}
		elsif( $dopeyPersonPutThisIn eq "xerOx" ){
		}
		elsif( $dopeyPersonPutThisIn eq "xeroX" ){
		}
		elsif( $dopeyPersonPutThisIn eq "XErox" ){
		}
		elsif( $dopeyPersonPutThisIn eq "XeRox" ){
		}
		elsif( $dopeyPersonPutThisIn eq "XerOx" ){
		}
		elsif( $dopeyPersonPutThisIn eq "XeroX" ){
		}
		elsif( $dopeyPersonPutThisIn eq "XERox" ){
		}
		elsif( $dopeyPersonPutThisIn eq "XErOx" ){
		}
		.
		.
		.

That's what you are saying.  But is it what you really
meant?

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch