Sv: aliasing a value in a while each loop

2001-07-23 Thread Davíð Helgason

John Porter wrote:
 Perhaps a simple
 
 alias( %foo, %bar );
 
 for those times when you really just need a simple WTDI!

Would 

 alias %foo = %bar;

not be ok, 'alias' acting and binding like 'my' of course. Or 

 my %foo is alias = %bar;


No?


/davíð




Re: Tying Overloading

2001-04-23 Thread Davíð Helgason

Hmm.

Larry Wall wrote: [to [EMAIL PROTECTED]]
 This is much like a method:
 
 my Cat chases (Dog $spot) :lvalue method = { ... };
 
 In either case, Cat is the type of the return value, and really has
 little to do with the implementation of the function (or hash) itself.
 $spot.chases is a Dog method, not a Cat method.  In the same way,
 %chases is a Catalog method, not a Cat method.


This wouldn't mean that anyone is thinking of getting us object
dot-syntax, now
would it? After giving it a thought, it seems that it can _mostly_ be
disambiguated from the concatenation operator. Whatever mostly means.

# given
$cat = bless [], 'Cat';
$purr = 'fish';

# we could have
$cat.purr();   # easy: $cat-purr()
$cat.$purr;# easy: Catfish
Cat.purr();# easy: Cat-purr()
Cat.$purr();   # hmmm: Cat() . fish (or Cat-$purr?)

# and
$cat = 'Cat';
$cat.purr; # Cat-purr() (or Cat . purr()?)


If $cat has method purr() and one has defined function purr(), all of
the above become ambiguous... So? A cut with the disambiguation-razor
would fix that, no?


This would make my life complete, especially if we get to do stuctish
things as well.

It seems that John Porter said something about this back in September
(http://ml.perl.org/archive.develooper.com/perl6-language_perl.org/msg04864.html),
and it has come up some ten times, but never had any final discussion.
There may be a good reason for that :(



Thanks for your:plural attention  now back to lurking,

d.
-- 
davíð helgason[EMAIL PROTECTED]



Re: Tying Overloading

2001-04-23 Thread Davíð Helgason

H.Merijn Brand wrote:
 
   $a = $b ~ $c; # Mmm!
  
   I like that last one a lot, because it doesn't disturb anything.
   You'd have to alter ~'s precedence so that binary ~ is higher
   than named unary operators. (It's print($a~$b), not print $a (~b).)
 
  I am not sure I do like the use of ~ here. It does not screan concatenate
  to me (but then again neither did . when I started perl)
 
  I am thinking that maybe it should be a 2 character operator with at
  least one of then being + as + is common in many other languages
  for doing concatenation.
 
 like ++ ?
 
 we have ** already for exponents

I _really_ think dot-syntax would make perl prettier as well as make it
more acceptable to the world of javacsharpbasic droids. Which is some
kind of goal, no? 

I suspect that we will never agree on anything here though.

Which of qw[~ ++ +~ + ] do we dislike the least?  Using + would be
nice, but introduce no end of problems with number/sting behaviour. ''
is too much like a certain unpopular language. And there was no end to
the quabbling :(

If we can make the concatenation into something else, we free the dot to
do string.length() and innumerable other niceties.

Suggestions?


ps. What do you think about the following sentence: we should steal
more from ruby? a) disgusting, b) uninteresting, c) clever, d)
wonderful.

pps. if ($_ === qw(b c d)) {
  === 'is in' operator, 
  dot operator remapped to mean,
  objectspace array/iterator as in ruby, giving access to all existing 
   data (but of course more complete than rubys rather flaky
implementation,
}

-- 
davíð helgason[EMAIL PROTECTED]