stevan / p5-mop-redux

A(nother) MOP for Perl 5
139 stars 36 forks source link

__CLASS__ keyword #35

Closed yuki-kimoto closed 10 years ago

yuki-kimoto commented 11 years ago

I comment about $class variable in commit page. You suggest

__CLASS__

keyword to me.

I open it as issue.


yuki-kimoto

I think lower case $class is sometimes used by user.

For example.

my $class = caller;
$self crash user variable very little, but $class will sometime crash user variable.

stevan: Yes, I have thought about that, but the most common usage of my $class = caller; is inside an import method, something that will not be relevant to the mop classes as they will never have exporters and any similar functionality will be done with mop events.

yuki-kimoto I think also namespace, controller and action, for example. $class is maybe often used than you expect. Is it enough Object and Class is accessed by $self?

stevan We will likely convert $class to be

__CLASS__

instead. However, keep in mind that if you want to create your own $class that is not an issue, you will simply be overriding the $class that the MOP created.