2009-12-27

funarg problem resolution

8.29: adda/1st-class functions/funarg problem resolution:
. the 1st-class function is said to involve the funarg problem;
for example,
the lisp`closure handles externals for the funarg problem
by replacing references to externals
with var's initilized with the external's current value .
. but, I'm thinking of 1st-class as meaning
that the function considers its value
to be the algorithm it was assigned .
. a function's type includes its permutation of inout types;
where this permutation includes more than its signature (input, output),
but also its expected externals .
. externals would work like file accesses:
when it came time to instantiate the funtion,
the caller would be expected to have a local whose name
matched the name of external being expected .
[12.19: in summary:
. the main issue was how to share code that is
dependent on the source context .
. the typical half-hearted way is to initialize the dependencies
with the current values;
whereas the 1st-class way is to just consider the dependencies to
like generics parameters .
]
. a separate issue is desiring to change algorithm values
by partially instantiating them;
(eg, f(x)`= g(x, x2=c)) .

9.27: adda/syntax/1st-class functions:
. what was the confusion about functions ?
if not declared using arg may need f`body or f`map;
otherwise, it works like ptr:
f(x)`=
f`=
.

11.12: adda/referring to caller:
. in a reflective system with first-class functions
the anon'code may want to know who called it;
is there always such a symbolic path?
yes:
because it cannot be evoked without referring to that path .
[you could have a request to call
all proc's in a random tree,
so the path could involve a lot of trivia .
. or it could look like
a lot of code was coming from the same symbol
if it was a pointer traversing a tree of code . ]
. what if wanting generic :
if (path)`type is fun`type
then the (path) @ (arg);
[12.24: the conventional use for @ is key@set
so then for calls, arg@function
]
. a function's type includes
not only arg and return type,
but also inout modes and expected externals .