Re: Sigils by example Juerd Waalboer schrieb:
> Thomas Wittek skribis 2007-05-15  0:48 (+0200):
>>> The Perl Way:
>>> $object.foo() calls the method called "foo".
>>> $object.$foo() calls the method that is in the variable $foo.
>> My way:
>> someref = &somemethod
>> object.someref()
>> Of course you could argue that you don't know in advance, if "object"
>> has a method with that name, so you cannot manually avoid the conflict.
> 
> Indeed. Now you have to know your object very well, and avoid all of its
> method names for variable names. For example, an HTTP::Request object
> has a .headers method. If Your Way were in effect, I could no longer
> safely use the name "headers" for my own variables, and then still call
> the "headers" method on the object.

You are right, it would not be practical to prohibit variable names to
be the same like any other object method names.

But still I can't imagine a useful example where I want so call a method
of object A on object B, which doesn't have this method.
Would it be a good idea to call methods on objects, that never thought
of this methods?
If it wasn't allowed to do so (because it may be not a good idea at all
-- i don't know), we wouldn't have that problem:

Storing a reference to a method of object A, that will only be called on
object A could be done like this:

  my ref = A.method
  ref()


> Perl allows both avoiding clashes and not-avoiding clashes. Your way
> only strictly requires the former programming style. And since my
> preferred style is different, I'm glad you're not designing Perl 6.

I'm also glad not to do that as I don't think that I'd have the
knowledge to do that.
I just offer my thoughts.

-- 
Thomas Wittek
http://gedankenkonstrukt.de/
Jabber: streawkceur@jabber.i-pobox.net

