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

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



||> 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!

Ok, my sarcasm may have been biting but it obviously wasn't instructive.
$^O =~ /mac/i does in fact evaluate to true under recent (for an
appropriate definition of recent) versions of MacPerl, there's never been
(at least from me) any argument on this. However, the "demonstrably wrong"
part is that it's *also true* under Mach, MachTen, emacs, MacroLogic,
DynaMachine, SemaCorp, etc. Ok, three of those are made up (I think), but
the point is, there are current systems and there could be future systems
with /mac/i in their name that don't act anything like a Mac. Therefore if
your script does:

if ($^O =~ /mac/)
{
	MacPerl specific stuff
}

and you run it on one of those other machines, it will fail in some way.
In my view, that's "demonstrably wrong."

|> 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.

Or not have some other facility that MacPerl has.

|If it does - then you are ok.  But if it doesn't, then everyone is
|hosed.

Yes, agreed. But you're also hosed in this case if you use
$^O =~ /mac/i, so I don't see how this case has any bearing on the
discussion.

|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.

No! The $^0 =~ /mac/i test *still* evaluates to true on *any* machine
with 'mac' (in any combination of upper- and lowercase) in it's name,
not just MacPerl.

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

Of course, but who said that? I agree that regular expressions are way
cool and think that any language that doesn't support them basically
sucks. However, that's not to say that all *uses* of regular expressions
are correct. Some *uses* are just plain wrong, for example...

|/12*0/ to look for all records which contain "1",
|possibly one or more "2"'s, and a "0".

this one.

|[Long if statement deleted.]
|That's what you are saying.  But is it what you really meant?

No, it's not anywhere close to what I'm saying. If you'll examine the
context in which this discussion started, you'll see I'm saying one
specific thing:

	"Using the expression $^O =~ /mac/i to test whether or not
	 a script is running under MacPerl is wrong."

And you can quote me.

Brian

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