From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,78609accbfa860fe X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!feeder.news-service.com!newsfeed-fusi2.netcologne.de!newsreader2.netcologne.de!news.netcologne.de!newsfeed-hp2.netcologne.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: usefulness of "data hiding" Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <72f07ba4-f06d-44bf-9759-0e6f0d0426d0@h20g2000yqn.googlegroups.com> Date: Sat, 17 Jan 2009 09:53:05 +0100 Message-ID: NNTP-Posting-Date: 17 Jan 2009 09:53:06 CET NNTP-Posting-Host: 8b3a1618.newsspool2.arcor-online.net X-Trace: DXC=G70Wf^IL4OXPU8j_I0DN6_A9EHlD;3YcR4Fo<]lROoRQ^YC2XCjHcbY^3QAZeYME[XDNcfSJ;bb[UIRnRBaCd On Fri, 16 Jan 2009 15:23:10 -0800 (PST), sjw wrote: > On Jan 16, 8:57�am, "Dmitry A. Kazakov" > 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