For my pet language I couldn't find a good way to have private fields.
There can be private fields if you provide "methods" in the sense of other
fields which hold functions (let's call them internal methods) which refer
to that private fields - no problem this way. But it's not possible to
have a field which can be accessed only from generic functions. Access
control + generic functions + dynamic typing doesn't mix. Pick any two
and it works. I chose generic functions and dynamic typing.
In my language you can define what does it mean to access a particular
field (read or write). This applies to plain variables too. So there can
be constant bindings, mutable bindings, lazy bindings, thread-local
variables, variables which mirror some external state in real time etc.
Variables are first class objects, but an expression being just a variable
name runs the reader.
Object fields are normally not accessed through getters/setters because
it would require introducing lots of global names.
Private generic functions - no problem. Private internal methods accessed
from other internal methods - no problem. But there are no private methods
accessible from generic functions and not just from anybody who holds a
reference to the object. Is it good enough?
Followup-To: comp.lang.misc; although my language is ropughly as
functional as SML/OCaml, this topic is independent from functional
__("< Marcin Kowalczyk