On 03/26/2016 10:03 AM, Matthias Felleisen wrote:
On Mar 26, 2016, at 9:12 AM, Matthew Flatt <[email protected]> wrote:
At Fri, 25 Mar 2016 22:13:16 -0400, Matthias Felleisen wrote:
[...]
I don't get the "referentially transparent" suggestion. The `(send o
m)` call belongs to the `server` module, not whatever object is the
value of `o` dynamically.
If you think of names as things that stand for ‘real' values
and that ‘standing for’ is a substitution, you must acknowledge
Quine’s observation that some positions in a language (technically
sentences in a language) are referentially transparent — you can
replace equals by equals there — and others are opaque — don’t
perform substitution there.
[Our poor simple-minded cousins in the FP community jumped
from there to ‘referentially transparency’ (as a good thing) and
never recovered.]
My mind considers the m position in (send o m a …) a referentially
opaque position. Hence define-local-member-name, which substitutes
names through a scope, should not replace this m — even if m is
in its list of names. Similarly, in (printf “(send o m 1)”)
define-local-member-name
should not peek inside the quotes. [This example is directly derived from
Quine’s treatise on language and everyone tends to agree. Other
positions in a language are subject to conversations among designers.]
You should think of (send o [] a ...) as a referentially transparent
context (but a member-key context, not an expression context). The only
bug here is the printing of the variable name 'm' in the error rather
than what it refers to. (That's what Robby's suggestion would fix.)
[...]
In languages that do not treat ‘send’ as a macro and in statically typed
languages (even unsoundly typed ones such as C++), I think it’s perfectly
okay if a ‘friend’ method m in C refers to a public method ‘m’ in class D.
That’s what I had imagined and that’s why I sent the message (though
I am hoping for an error message).
"friend" is a concept that belongs to an access-control-based object
system, but Racket's object system is capability-based.
In particular, you could think of a hypothetical `(friend m)` form as
attaching some new access-control information to `m` (in the scope of
the friend declaration), but leaving the identity of `m` as a member key
alone. In contrast, `(define-local-member-name m)` substitutes
member-key references to `m` with a fresh unrelated key.
Ryan
--
You received this message because you are subscribed to the Google Groups "Racket
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-dev/56F6B75E.6040006%40ccs.neu.edu.
For more options, visit https://groups.google.com/d/optout.