Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 53865
Status: rejected
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: randomcoder1 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: shorter code (forgetting $self)
I'm doing this right now to write less code: local *i = \$self->elements->[$i]; local *j = \$self->elements->[$j]; local *ij = \$self->operation_table->[$i]->[$j]; ${*ij} = ${*i} * ${*j}; the direct way to do it would have been: $self->operation_table->[$i]->[$j] = $self->elements->[$i] * $self->elements->[$j] can all attribute or method names be mapped with a rule like this X => $self->X so that I don't have to write $self in front of each of them ? or would this cause other problems as well ? maybe there's already some MooseX:: module that does it, I wasn't able to find it. -- Your bugs , they are afraid of me.
On Wed Jan 20 20:41:00 2010, WSDOOKADR wrote: Show quoted text
> I'm doing this right now to write less code: > > local *i = \$self->elements->[$i]; > local *j = \$self->elements->[$j]; > local *ij = \$self->operation_table->[$i]->[$j]; > ${*ij} = ${*i} * ${*j};
See also Data::Alias to get rid of the clunky globref syntax. Show quoted text
> can all attribute or method names be mapped with a rule like this > > X => $self->X > > so that I don't have to write $self in front of each of them ?
No. You want .foo syntax from Perl 6. Show quoted text
> or would this cause other problems as well ?
You have described Ruby's method resolution, which has its own problems. Show quoted text
> maybe there's already some MooseX:: module that does it, I wasn't able > to find it.
This kind of syntax hackery is far beyond the scope of Moose.