Re: AUTOLOAD method
"Vadim O. Ustiansky" <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
Dear Dave,
On Sun, 6 Jun 2004, Dave Rolsky wrote:
> I'm not really a big fan of Perl's AUTOLOAD, so I don't really like this
> idea.
Why not? Yes, I agree that it's better to avoid using AUTOLOAD where it is
possible. But where it is really needed it seems to be powerful and elegant
solution.
> Of course, with Perl itself, I usually just generate code during compile
> time, with something like this:
>
> foreach my $f (@fields)
> {
> *{$f} = sub { $_[0]->{$f} }
> }
>
> You can't really do that so easily with Mason, I guess.
Yes, I have thought about something like that, especially taking into account
that with Perl one often put such stuff inside AUTOLOAD. But I decided that
with Mason doing this on a per-request basis does not seem to be very useful
while doing this on a permanent basis will result in the growth of the size of
object files. So if one want to dynamically generate methods the best way
seems to do it by means of something like AUTOLOAD method.
--
Yours sincerely,
Vadim.
>
> -dave
>
> /*=======================
> House Absolute Consulting
> www.houseabsolute.com
> =======================*/
>
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504