[cgiapp] ($self vs $c) was: Re: New Plugin: RunmodeDeclare

Joshua Miller unrtst at gmail.com
Mon Sep 29 12:22:10 EDT 2008


One more vote for $self.

My reasoning - I've inherited a few projects that use something other than
$self, and each had decided it was smarter than sticking to the standard
$self. Try to integrate those, and not constantly forget on which module
you're currently working! And now, a bunch of that project is new,
converted, or imported code using "$self", an awful lot is still using
"$this" (they were php immigrants), and there's a few random places that try
to type less and use something like "$c" or "$s".

If one wants to adopt a standard of using "$c" in place of "$self" across
their own project, I have no problem with that - it's one of the great
things about perl, more than one way to do it and all that. But for stuff
meant for the general population of CPAN, 3 extra characters won't kill
anyone. At the very least, for the docs.

As for $t, maybe it's just me, but that's my first choice for any
short-lived temp variables, so I've stuck to $tmpl for the template object.
Reads better to me, and hopefully to the next maintainer. YMMV

--
Josh I.

On Mon, Sep 29, 2008 at 11:39 AM, Richard Jones <ra.jones at dpw.clara.co.uk>wrote:

> Michael Peters wrote:
>
>> Richard Jones wrote:
>>
>>  Actually prefer $c these days as a) it's shorter and therefore quicker
>>> and less easy to mis-spell (I seem to type slef more often than self), but
>>> more importantly, having done a lot of work with Catalyst recently, that's
>>> the Cat standard also, so it's familiar to me.
>>>
>>
>> This actually came up in our discussions and we thought it would cause
>> more confusion since in Catalyst the $c is not $self. It's a different
>> object entirely. So calling it $c in C::A land might confuse the catalyst
>> folks since it's really $self just shorter. Also, for folks playing with
>> Titanium (which btw, does not have a friendly abbreviation :) do you plan on
>> still using $c? Or will you go with $t?
>>
>>
> Yes it's true it could be confusing as we won't need to *manually* shift
> the class object into a variable any more, so the self-documenting nature of
> this step is effectively lost to the unfamiliar observer.
>
> For me though, I still think I prefer the shorter form as it's used in all
> rms and sometimes multiple times within an rm. And providing it doesn't
> clash with any other abbreviated variable name and its use is consistent
> throughout I think it should be OK. Personally I'd be happy to use $t for
> the Titanium object since the letter 't' is even closer to the '$' key than
> is the letter 'c' ;)
> --
> Richard Jones
>
>
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://lists.openlib.org/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://lists.openlib.org/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
>
>


More information about the cgiapp mailing list