On Jan 1, 6:36 pm, Peter van der Zee <qfo...@gmail.com> wrote:
> On Sun, Jan 2, 2011 at 12:17 AM, jemptymethod <jemptymet...@gmail.com>wrote:
>
> > On Jan 1, 10:08 am, jmulligan <jason.mulli...@avoidwork.com> wrote:
> > > I do something similar with my lib (http://github.com/avoidwork/
> > > abaaso) that's under dev. It works well, but you can't use private and
> > > public. they're reserved.
>
> > That's why I slap "$" on front of private and public.
>
> Instead of $ (dollar) prefix, you could also _ (underscore) prefix private
> methods. That way you don't have to artificially grow your (public) method
> names with php-like ugliness. I personally use the $ prefix for variables
> returned by libraries like jquery or prototype. To easily distinct those
> from regular dom (or other) vars.
>
> I think the underscore is kind of the js-way, but I don't really have
> anything to back that up so somebody might correct me on the issue :)
>
> Whenever I see $ prefixed vars, and they're not clearly used to distinct var
> contents, I usually suspect a php user. Especially if they don't use `var`

Usually the innards of your module aren't going to be interacting with
jQuery or other libraries.  What I'm getting at with $private and
$public is that, I don't have to have comments that say: //private
or //public.  If I was going to use an underscore, I would use it for
both: _private and _public.  This is implementation code after all,
plus the whole "_" prefix to suggest private is anathema, to those
familiar with Crockford.  Regardless, realizing that "_" might confuse
those who have used it to suggest privacy, I chose $, regardless of
the PHP (or Perl) stigma thing.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to