On 30 Jul 2009, at 20:06 , Falcolas wrote:
On Jul 30, 11:56 am, Masklinn <maskl...@masklinn.net> wrote:
On 30 Jul 2009, at 19:37 , Jean-Michel Pichavant wrote:
r wrote:
How do I know if foo.value is an attribute or if it is a method that
returns the foo value ?
It cannot be an attribute. Ruby doesn't give access to attributes,
they're always solely private (as in Smalltalk). Also you shouldn't
reply to r, he has no idea about what he's talking about.
That doesn't sound like a feature I would appreciate much, though I am
a big fan of "we're all adults here" programming. Though if they are
all functions, then adding parentheses wouldn't make much difference,
so offering the option of getting rid of them makes sense.
That's pretty much it.
I would have
trouble saying, just based on the calls above. I would have to go
back
to the definition or documentation of foo to identify which is doing
what. On the other hand, the following gives a better clue as to
what
is happening (granted not perfect, but better):
Well... it doesn't give much of a clue no really.
It, with few exceptions, tells me that fetching the value foo.val will
not modify the state of foo. Important stuff, at least to me.
But because of those few exceptions, it really tells you that foo.val
*probably* doesn't modify the state of foo. Unless you go source-
diving, you can't know for sure. Only Haskell gives you that kind of
guarantees (and even then, the code you call could have an unsafe*
somewhere)
--
http://mail.python.org/mailman/listinfo/python-list