[nem-en] Scala: what you say about it?
NoiseEHC
NoiseEHC at freemail.hu
Sun Nov 19 13:32:03 CET 2006
Ok, another question:
It is one of my old ideas that there should be support for some kind of
context oriented programming (in any language, it is older than I know
Nemerle). So the problem it would solve that normally if you write
components you have to pass around a lot of stuff from the caller to the
component, and it is really frustrating to type all those parameters for
every fucking function. The example here is that in the compiler you
have to pass around this "ManagerClass.Instance" thing. Note that object
oriented programming is just a subset of context oriented programming
where "this" is the context. It should (in my opinion, never used
anything like this) provide an alternative to variable capture when in
LISP you can use a variable name and it is captured from the caller's
scope (not sure about this since as I said never used LISP). Another use
would be to define methods which could act on parent-child collections.
Where the child does not have a reference to its parent, every fucking
function have to have a "Parent" parameter. It should also solve the
problem of hosting (for example logging), what I normally handle by
every component defining an interface which must be implemented by the
caller (host). This problem is directly addressed in the Scala video so
maybe it is important enough to have a language supported solution.
Finally, this context thing should have some support to explicitly
define contracts which are not variables but just compile time
verifiable expressions, for example locking, so one function could
define that some lock must/must not be held.
You are probably know enough about language design that you can point to
other languages which address those requirements so it should not
reinvent the wheel. Is it a practical thing or just stupid? Will we have
support for it or we may already have it?
ps:
I am aware that this email is not too clear so if you need some more
descriptions/examples say so.
More information about the devel-en
mailing list