On Fri, 2006-09-01 at 22:49 -0700, Erick Tryzelaar wrote:
> skaller wrote:
> and then we modify the compiler to somehow select which backend to use,
> since the compiler already needs intimate knowledge of what language
> it's targetting.
I am systematically eliminating this coupling. Already quite
a few features such as the definition of
x.y = get_y x = "$1.x"
have been eliminated. Instead of this, Felix generates
a combinator like
`BEXPR_get_n (expr,name)
which defers the implementation to the back end, instead
of using magical primitive bindings in the front end.
The problem is that the number of combinators has grown,
and the handling of them is not properly orthogonal:
they're 'ad-hoc'.
To see what I mean, consider that the 'get_n' combinator
above requires two arguments: an object expression and
a field name. So it cannot handle the idea of offsets
(in C++ pointers to members) or calculate with them.
This could be done by providing a lambda abstraction:
lambda x . get_n (x,name)
is an offset for which the object expression has been abstracted
away (eliminated) by making it a parameter. This could work
for many closed terms.
Alternatively, I could just define a term
`BEXPR_offset (t, name)
which represents an offset directly, and another set of combinators
like
add (offset, offset)
bind (object, offset)
to complete the calculus.
Just to give a related example from a prior post: how do we
handle C pointers in Felix?
Using a primitive binding like ptr[t]="?1*" isn't really
satisfactory because the compiler cannot calculate with
abstractions.
Either the meta-programming system is souped up to allow
user level calculations, OR, we could just bite the bullet
and make a new fundamental type constructor
`BTYP_cpointer T
and provide built in operators for it such as
`BEXPR_deref_cptr x
Of course I prefer souping up the meta-programming,
but it is much harder to do. Sometimes the way forward
is to introduce new features (=HACKS) until the system
is so burdened with them it becomes unworkable,
and then refactor: the advantage is the existing semantics
constrain the refactoring, and thus guide the redesign.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language