comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: usefulness of "data hiding"
Date: Sat, 17 Jan 2009 09:53:05 +0100
Date: 2009-01-17T09:53:06+01:00	[thread overview]
Message-ID: <uyoi4019mvfl.mb8rypxt7qgr$.dlg@40tude.net> (raw)
In-Reply-To: d5816af9-0d30-49d8-b479-d9d928359d08@z27g2000prd.googlegroups.com

On Fri, 16 Jan 2009 15:23:10 -0800 (PST), sjw wrote:

> On Jan 16, 8:57�am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>> On Thu, 15 Jan 2009 16:51:38 -0800 (PST), Russ P. wrote:
>>> As many of you probably know, Python had no data hiding.
>>
>> Python is a dynamically typed language. When dynamic typing is considered
>> conceptually that inevitably leads you to weak and then to no typing. In an
>> effectively untyped framework (this includes massive type inference as
>> well), you necessarily have to drop encapsulation. There is nothing to
>> hide, and nothing can be hidden.
> 
> I have seen it said (maybe about Python) that that sort of language
> has untyped variables but strongly typed values in that the value
> knows what it is and what can be done to (by) it.

But you don't deal with values (more precisely objects) in the program. You 
do with the variables denoting objects or expressions constructing objects 
etc. When these are effectively untyped, then the language is, per use. I 
include here the case when "everything is Object."

> Of course you can't tell whether o.lower() will return the lower-case
> version of the string o or the tune o transposed down by a semitone or
> a runtime error, which does make it kind of hard to reason about the
> program; but I don't see where that equates to dropping encapsulation.

That is because types as sets of values sharing some operations do not 
vanish. They still exist, all people use this abstraction when programming 
already at minimal level of reusability [*]. Even if the language does not 
spell types properly, it has some substitute for types and their algebra. 
If the language does not use nominal typing like in Ada, then it does 
structural one and/or type inference. My point was, that when you go for 
structural /inferred typing, you have to lose at least some encapsulation.

------
* When you write code to be used by another programmer

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2009-01-17  8:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-16  0:51 usefulness of "data hiding" Russ P.
2009-01-16  1:08 ` Russ P.
2009-01-16  1:33 ` Adam Beneschan
2009-01-17 19:05   ` Marc A. Criley
2009-01-19 16:15     ` Adam Beneschan
2009-01-16  8:57 ` Dmitry A. Kazakov
2009-01-16 23:23   ` sjw
2009-01-17  8:53     ` Dmitry A. Kazakov [this message]
2009-01-18 13:07   ` Graham Stark
2009-01-18 14:17     ` Dmitry A. Kazakov
2009-01-16 17:21 ` Nicholas Collin Paul Gloucester
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox