Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.lightlink.com!news.iecc.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!news4 From: Wojtek Newsgroups: comp.lang.java.programmer Subject: Re: Any experience on teaching Perl programmers Java Date: Wed, 26 Oct 2011 23:27:25 -0700 Organization: NewsGuy - Unlimited Usenet $19.95 Lines: 23 Message-ID: References: NNTP-Posting-Host: p619a0ae299392c4fc2a9a0d9d8a6713c0655eff6a9dc854b.newsdawg.com Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit X-Newsreader: MesNews/1.08.03.00-gb Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9231 saxo123@gmx.de wrote : >> The one thing Perl doesn't have is data hiding. > > As a matter of fact Smalltalk doesn't have that, either. Once you add > getters and setters for a variable it becomes public. Um, no. A getter/setter can also be private or default (package visible). And the actual variable (field) is still hidden (private). A getter/setter is a method. You can stuff as much code as you want into it, though you should follow the basic contract of a getter/setter, ie saving the passed value and returning it. I've written setters that store the passed value, then manipulate it in some way and then store that. So a single setter actually sets two values, and there are two related getters. -- Wojtek :-)