[nem-en] Typing a expression in context of method
Kamil Skalski
kamil.skalski at gmail.com
Sat May 12 11:23:30 CEST 2007
I'm not really sure what you want to achieve. To type an expression
you should use TypeExpr method of Typer. I've made a simple
refactoring to allow separate creation of Typer and running the actual
typing process, maybe it will help.
I guess the main difference of TypeExpr and fully typing process is
that TypeExpr does not do any delyed typing and any stages > 1. I'm
not sure if this is really a problem, since if TypeExpr cannot type
expression without going with delayed typing, then it means that the
wider context is needed to type this expression and this requires
usually a whole method to be typed.
On the other hand typing
{ def f (x) { x.Foo } f (Bar()) }
, which can be fully typed locally, probably also needs the delayed stage...
To make typing fully independent of the processed MethodBuilder, we
would need to refactor RunTyping, Typer2, 3, 4, RunSecondPass, etc.
I'm not sure if that makes sense. Maybe a better way would be to add
some richer logic for typing single expression. But first we would
need to agree on what we actually want to achieve this way.
2007/5/11, vc <vc at rsdn.ru>:
> > > Maybe pick out RunTyper from constructor and add to RunTyper parameter
> > > through which pass expression for typing? And so as to RunTyper return
> > TExpr
> > > Instead of replacing corresponding MethtBuilder state (convert logic of
> > > Typer to functional manner)? At now logic of Typer wery hard to
> > understand.
> > >
> > > Add will be very nice if Typer will get reference to Messenger parameter
> > > instead of get it from solver (in Integration we type methods in lazy
> > manner
> > > and we need intercept messages from typer).
> > >
> >
> > Good idea.
>
> I tried to make it in last week, but rollback my changes as it too
> difficultly for me. :(
>
> Vlad
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
--
Kamil Skalski
http://nazgul.omega.pl
More information about the devel-en
mailing list