I've used it in perl code to indicate something *should* be private; however since this is perl you can do whatever you want anyhow and it's just a suggestion.
-Matt Beldyk On Tue, May 3, 2011 at 7:23 AM, Joey Gibson <j...@joeygibson.com> wrote: > On Mon, May 2, 2011 at 1:45 PM, Chris Koerner <chessm...@gmail.com> wrote: >> >> Just curious, under what circumstances in ANY language do you use an >> underscore in front of a variable/method/object? > > I've never been a fan of underscore prefixes, but I have recently adopted > them when working in Objective-C. If I wanted to have an ivar foo, the > convention is to have the property that access that ivar be foo/setFoo:. > While I *could* have both an ivar called foo and a property called foo, it's > a little confusing. For example, > self.foo = 23; > foo = 23; > Those are not the same thing. The first is using the property, while the > second is directly accessing the ivar. So now I define ivars as @private and > with a leading underscore to make it very explicit if I'm accessing the ivar > directly. > Joey > > > -- > Blog: http://joeygibson.com > Twitter: @joeygibson > Facebook: http://facebook.com/joeygibson > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to javaposse@googlegroups.com. > To unsubscribe from this group, send email to > javaposse+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javaposse@googlegroups.com. To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.