[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (eq #'eq #'eq) (reply to Jeff Dalton)

> If SYMBOL-FUNCTION "returns the autoloader function", then (eq f #'eq)
> ...actually, this works out, but very peculiarly.

It is not even slightly peculiar.  (SYMBOL-FUNCTION 'F) returns
whatever it returns.  Presumably it does this consistently.  There are
two main cases: (1) F does not need to be autoloaded, and (2) F does
need to be loaded.  The second case then has two subcases: (2a)
SYMBOL-FUNCTION causes the autoload to happen, or else (2b) it returns
the autoloader function.

Suppose F does not need to be autoloaded.  Then SYMBOL-FUNCTION
returns the function value of F.  If you call it again, it returns
that very same object (the function value) again.  So these two
results are F.  Now suppose F needs to be autoloaded.  Either
calling SYMBOL-FUNCTION on F causes the autoloading to take place,
and we are in the same situation as above, or else it does not cause
the autoloading to take place but instead returns a function object
that, if called, will autoload F.  Again, if you call SYMBOL-FUNCTION
again it will presumably behave in the same way and return the very
same <call me and I'll autoload F> function object.  Again the
results are EQ.

Since this argument is independent of choice of F, it applies when
F is the symbol EQ.

> I still don't consider this fortuitous setup to justify your point,
> though.

It is not a fortuitous setup.  Access functions (such as SYMBOL-
FUNCTION) return objects.  Object identity can be tested with EQ.

Of course, you might say that SYMBOL-FUNCTION isn't a simple access
function.  Perhaps it's not like SYMBOL-VALUE at all.  Perhaps it
always makes a new function object.  If we take this line, then I
am saying that SYMBOL-FUNCTION should change to be like SYMBOL-
VALUE.  Again, this is neither peciliar nor fortuitous: it is just
a question of how SYMBOL-FUNCTION should behave.

> Autoloading isn't the only rationale in any case.  Consider
> a system with multiple copies of the same function (perhaps liked into
> several modules, or compiler-generated as quasi-inline minisubrs, or
> whatever).  

I don't really know what you have in mind here, so I'm probably going
to miss the point.  I don't, for example, know what you mean by "the
same".  If "same" means EQ, then they aren't copies.  And I'm talking
only of #'F.  This has different from cases like (F...), where F
might be compiled in-line.

-- Jeff