On Tue, Apr 24, 2001 at 05:44:49PM +0100, Michael G Schwern wrote:
> On Tue, Apr 24, 2001 at 12:32:29PM -0400, John L. Allen wrote:
> > I think someone may have mentioned this already, but why not just say
> > that if you want '.' to mean concatenation, you have to surround it on 
> > either side with white space?  If there's no white space around it, then 
> > it is forced to mean method invokation, or whatever else.
> 
> This approaches "whitespace as syntax".  Very few Perl operators care
> about whitespace between their words (even ->) or whitespace at all.
> 
> More generally, its going to cause alot of careful squinting at code
> to distinguish between different operators.  This will lead to subtle
> bugs because someone accidentally put a space after the . and didn't
> notice.
> 
> Its just cutting it too thin.  Don't go this route unless others are
> exhausted first.

ok, well.. I've heard arguments for '+' (namely that its intuitive, other 
language compatible, etc...) so what are the arguments against it?

after all, it has a corresponding operator in minus:

"hey" - "y" = "he"
my $singluar = $plural - "s"; 

The only thing I could see gumming up the works is if one argument is a string,
and the other argument is a number, and both are in variables:


        my $a = "hello";
        my $b = 3;


        print $a + $b;  # should print "hello3";

        print $b + $a   # prints 3hello; 

This would be doable ( along with making "$a > $b" context dependent ). 
Question is, would it be too confusing, too prone to error?  I like it better 
than '~' (which seems odd to me..)

As for '.', well I think that makes sense if packages are 'first class', and 
they can contain variables, ie:

class MyClass
{
        my  $a = 1;   # instance variable
        our $b = 2;   # static variable
        my @c = (1,2);
}

my $b = new MyClass()

print $b.a;
print @b.c
print $b.d{'a'}
print $MyClass::b;

Ed

Reply via email to