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

2008-09-29 Thread Richard Jones

Mark Stosberg wrote:


Although I still prefer $c in my own code, I thought they made good
points, so I switched back from $c to $self in the docs and code of
the latest CGI::App dev release. 


But I'm interested in more opinions on the issue. Richard, do you
particularlly prefer $c, or were you mostly following along the docs
that were updated to switch from $self to $c ?


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.

--
Richard Jones

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




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

2008-09-29 Thread Michael Peters

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?


--
Michael Peters
Plus Three, LP


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




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

2008-09-29 Thread Richard Jones

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://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




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

2008-09-29 Thread Joshua Miller
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 [EMAIL PROTECTED]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://www.erlbaum.net/mailman/listinfo/cgiapp##
 ####
 ##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
 ##  Wiki:  http://cgiapp.erlbaum.net/ ##
 ####
 



#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




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

2008-09-28 Thread Mark Stosberg
On Mon, 29 Sep 2008 00:18:02 +0100
Richard Jones [EMAIL PROTECTED] wrote:

 Mark Stosberg wrote:
  As Rhesa proposed, he has followed through and released a plugin to add the
  Devel::Declare / Method::Signatures magic to CGI::Application:
  
  http://search.cpan.org/perldoc?CGI::Application::Plugin::RunmodeDeclare
 
 Looks like an interesting alternative to CAP::AutoRunmode. One minor 
 irritant is having to put 'runmode foo ($c:)' everywhere (only if using 
 $c instead of $self of course). Might be useful to be able to declare 
 use CGI::Application::Plugin::RunmodeDeclare(invocant = '$c'), or just 
 use CAP::RunmodeDeclare qw($c).

I agree with this sentiment.

This brings back to life the discussion we were having on IRC the other
day about $self vs $c.  

I like $c because it's shorter and since it's used all over the code
base, it's clear enough what it is. And, the first element to 'shift'
off of @_ in a method must be the invocant. 

Michael Peters and Richardo argued in favor of $self citing the
Principle of Least Surprise and the expectation that this non-standard
change would generate more harm in confusion than benefits in
keystrokes. 

Although I still prefer $c in my own code, I thought they made good
points, so I switched back from $c to $self in the docs and code of
the latest CGI::App dev release. 

But I'm interested in more opinions on the issue. Richard, do you
particularlly prefer $c, or were you mostly following along the docs
that were updated to switch from $self to $c ?

Mark

-- 
http://mark.stosberg.com/blog




#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




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

2008-09-28 Thread George Hartzell
Mark Stosberg writes:
  On Mon, 29 Sep 2008 00:18:02 +0100
  Richard Jones [EMAIL PROTECTED] wrote:
  
   Mark Stosberg wrote:
As Rhesa proposed, he has followed through and released a plugin to add 
the
Devel::Declare / Method::Signatures magic to CGI::Application:

http://search.cpan.org/perldoc?CGI::Application::Plugin::RunmodeDeclare
   
   Looks like an interesting alternative to CAP::AutoRunmode. One minor 
   irritant is having to put 'runmode foo ($c:)' everywhere (only if using 
   $c instead of $self of course). Might be useful to be able to declare 
   use CGI::Application::Plugin::RunmodeDeclare(invocant = '$c'), or just 
   use CAP::RunmodeDeclare qw($c).
  
  I agree with this sentiment.
  
  This brings back to life the discussion we were having on IRC the other
  day about $self vs $c.  
  
  I like $c because it's shorter and since it's used all over the code
  base, it's clear enough what it is. And, the first element to 'shift'
  off of @_ in a method must be the invocant. 
  
  Michael Peters and Richardo argued in favor of $self citing the
  Principle of Least Surprise and the expectation that this non-standard
  change would generate more harm in confusion than benefits in
  keystrokes. 
  
  Although I still prefer $c in my own code, I thought they made good
  points, so I switched back from $c to $self in the docs and code of
  the latest CGI::App dev release. 
  
  But I'm interested in more opinions on the issue. Richard, do you
  particularlly prefer $c, or were you mostly following along the docs
  that were updated to switch from $self to $c ?

I'll toss in one vote for $self being much less Surprising, both to me
and to folks with whom I'm sharing code.

g.


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




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

2008-09-28 Thread Ron Savage
Hi Folks

 I'll toss in one vote for $self being much less Surprising, both to me
 and to folks with whom I'm sharing code.

Yep. $self for me.

-- 
Ron Savage
[EMAIL PROTECTED]
http://savage.net.au/index.html



#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####