Re: Why does python not have a mechanism for data hiding?



On Jun 8, 5:40 am, Mark Wooding <m...@xxxxxxxxxxxxxxxx> wrote:
Russ P. <Russ.Paie...@xxxxxxxxx> wrote:
The idea of being able to discern properties of an object by its name
alone is something that is not normally done in programming in
general.

Really? You obviously haven't noticed Prolog, Smalltalk, Haskell, ML,
or Erlang then. And that's just the ones I can think of off the top of
my head.

* Prolog and Erlang distinguish atoms from variables by the case of
the first letter; also `_' is magical and is equivalent to a new
variable name every time you use it.

* Smalltalk distinguishes between global and local variables according
to the case of the first letter.

* Haskell distinguishes between normal functions and constructors
(both data constructors and type constructors) by the case of the
first letter, and has Prolog's `_' convention.

* ML allows a single-quote in variable names, but reserves names
beginning with a single-quote for type variables. It also has
Prolog's `_' convention.

As far as I can see, discerning properties of a thing from its name
seems relatively common.

Well, "common" in Prolog, Smalltalk, Haskell, ML, and Erlang is hardly
common in general. I'll bet that Java and C/C++ are used more in North
Dakota than all those languages combined are used in the entire world.
That's not to say they aren't interesting academic languages, of
course.

As for using the case of the first letter to distinguish between local
and global variables, is that just a naming convention or is it
actually enforced by the compiler (or interpreter)? If it's actually
enforced, that seems rather restrictive to me. What if I want to name
a local variable after a proper name or an uppercase acronym? I guess
I'm just out of luck.
.



Relevant Pages

  • Re: Why does python not have a mechanism for data hiding?
    ... You obviously haven't noticed Prolog, Smalltalk, Haskell, ML, ... or Erlang then. ... Smalltalk distinguishes between global and local variables according ... Haskell distinguishes between normal functions and constructors ...
    (comp.lang.python)
  • Re: Bumping Smalltalk with Prolog - any progress ?
    ... Well, Erlang is dynamically typed, and the syntax is Prologish. ... Erlang doesn't have logic variables or search. ... Smalltalk is Oz: ... it's reasonable to regard Oz as a combination of Prolog ...
    (comp.lang.prolog)
  • Re: BIGGEST STEP TO TAKING HASKELL MAINSTREAM
    ... and how programming and debugging on ... PR> But I thought Erlang used a microthread model and didn't support ... PR> And is there any kind of multiprogramming support in Haskell? ... most widely used technology ...
    (comp.lang.functional)
  • Re: Verbose functional languages?
    ... and so rule out Haskell. ... I certainly use OCaml and F# far more than other functional ... conclusion that I am more a fan of Erlang than Haskell or Lisp for the ... simple reason that Erlang has seen far more practical success and is ...
    (comp.lang.functional)
  • Re: Is it just a matter of taste?
    ... found Haskell the easiest for me to understand, ... say Erlang does better at parallel execution, ... I've been reading some papers about functional language's SMP support ... formula as to which language to prefer for a particular case. ...
    (comp.lang.functional)