# New Ticket Created by  Klaas-Jan Stol 
# Please include the string:  [perl #45859]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=45859 >


Hi,

This proposal is about resolving method names: bare words or quoted

it might be that i'm not well informed on this issue, so please correct me
where I go wrong.


IMCC currently allows for method call syntax like this:

foo.bar()
foo."bar"()

Both invoke the method named "bar" on the object "foo", UNLESS there is a
local variable named "bar", in which case the first statement will invoke
the method whose name is stored in that local variable.

This is confusing, and makes reading code not easy (imagine having a
subroutine of 50+ instructions, and debugging it)

PCCMETHODs (a method on a pmc written in C) is, IIRC, invoked using a bare
word methodname like so:

foo.bar()

So, what is called here? Is bar a method, a PCCMETHOD (but I guess that does
not matter), or a local variable containing the name of a method?



In order to prevent confusing, I propose that methodnames are always written
between quotes. This should also be true for PCCMETHODs.
Only then is it always clear when calling a method whose name is stored in a
local variable, or if it's actually the name of the method that was written.

I think the method "new" on a class is a PCCMETHOD, right?
This would mean that you would create a new object instance like so:

.local pmc b
b = Foo.new()

Having to write

b = Foo.'new'() might seem inconvenient, but I think it's a matter of
getting used to, and it is more consistent.

Consistency is good.

The assembly language (if you can call PIR that) should not have too many
rules and exceptions.

Reply via email to