Hi Michael,

From a quick read of your idea, the first thing that struck me was the 
similarity to partial application/currying in the derivative direction, which 
has already been mentioned by Ian.

If I understand correctly then there's the potential for ambiguities to arise 
if we differentiate WRT 2 different objects, and we're calling the same method 
on both. Whilst I see the usefulness for the technique, I can forsee this 
being a problem. I think a useful addition to offset this could be ML-style 
pattern-matched arguments, so that in an ambiguous case the environment could 
choose whichever receiver is matches the arguments most specifically.

As for the other direction, I've personally been thinking about a similar 
method of automatically abstracting functions. Rather than injecting new 
arguments, we generate a separate, more generic function from which we can 
reconstruct the original function by specifying the arguments. This is similar 
to how the antiderivative of f(x) describes the shape of f(x), but requires 
normalising with a constant to completely reconstruct f(x). For example we 
could turn:

def foo(a, b):
    a.bar('hello')
    b.baz('world')

into the following:

def abstracted(ob1, ob2, meth1, meth2, arg1, arg2):
    ob1.meth1(arg1)
    ob2.meth2(arg2)

def foo(a,b):
    abstract(a, b, bar, baz, 'hello', 'world')

Here the "abstracted" function can be seen as the antiderivative of the "foo" 
function. We then redefine foo as a derivative of "abstracted". Of course the 
"shape" of foo (2 arguments, calling a different method on each with different 
arguments) is a very common occurance, and our "abstracted" function abstracts 
over all of these.

My motivation for thinking about this is experimenting with static analysis 
and automatic program generation. With enough abstraction, the specifics of 
any program can be decomposed into arguments for such generic functions, which 
gives us a very abstract place to perform source-to-source translation, tree-
rewriting, etc. It may even be possible to turn the implicit sequencing of 
operations (such as ob1.meth1 followed by ob2.meth2 above) into explicitly 
sequenced operations, like those in monads and arrows. I've been playing with 
this in OMeta, naturally ;)

I think the parallels with your notion of more-implied = derivative and more-
explicit = antiderivative is interesting, and would value people's thoughts.

Thanks,
Chris Warburton

_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to