[closer-devel] the implicit context argument contextl and its implications

Attila Lendvai attila.lendvai at gmail.com
Mon Mar 5 20:28:54 UTC 2007


dear list,

recently i was doing more and more complex stuff with contextl and i
fooled myself by beliving that the introduced implicit argument is the
most important in the dispatch.

after quite some time spent on hunting down a behaviour that we didn't
understand, we finally realiezd that :argument-precedence-order is
explicitly defined for layered generics and the implicit context
argument is defined to be the least important in the dispatch.

i think this is not the most useful default value and it should be
changable when using define-layered-function. i've got some small
background in subjective dispatch stuff (see the Slate docs and its
reference at http://slate.tunes.org/doc/progman/node10.html#SECTION00044700000000000000
)
and i had the false assumption that the layer arg is the most
important, because it's called layer in those docs i've read. these
docs called the most important "layer" and the least important
"subject".

with the above nomenclature, layers can be used to override big chunks
of libs/algorithms, while subjects can be used to fine-tune very
specific parts. contextl, as implemented today, only has subjects.

this brings up some interesting toughts: layered methods could be
generalized to contain any number of implicit args (contexts) at any
position in their dispatch. this may or may not be over-engineering,
because having both a first and a last implicit argument covers most
of the cases, but i think i could use for example two implicit first
args that are two orthogonal contexts. (one would be a layer/context
representing a gui rendering backend, and the second layer/context
would represent a gui form that can contain customizations for a
generic presentation algorith that are specific to that form)

but to get back to something more specific, what do you think about
moving the context arg to the most important in the dispatch by
default and/or making it customizable?

any toughts?

-- 
- attila

"- The truth is that I've been too considerate, and so became
unintentionally cruel...
 - I understand.
 - No, you don't understand! We don't speak the same language!"
(Ingmar Bergman - Smultronstället)


More information about the closer-devel mailing list