Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xbase] Rewriting an expression to conform to expected type
[Xbase] Rewriting an expression to conform to expected type [message #699429] Thu, 21 July 2011 14:04
Eclipse UserFriend
Originally posted by:


I've mentioned before that I'm fond of Scala's shorthand notation for
unary functions, e.g. instead of o | or [o |]. The
argument against supporting something like this is that it has the same
syntax as an ordinary expressions, hence, you cannot parse it into a
closure object.

However, since Xbase supports type inference, it should be able to
notice that the context requires a (unary) function and do the rewrite.
I.e. rewrite myList.find( to myList.find(_|
when type inference shows that the expression's type (boolean) does not
match the expected function type. I suppose this could be generalized to
supporting rewriting an expression when types don't match, e.g. parse a
string to an int, etc.

Previous Topic:Grammar w. hundreds of message types
Next Topic:Troubles with content assist
Goto Forum:

Current Time: Sun May 09 13:35:45 GMT 2021

Powered by FUDForum. Page generated in 0.01487 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top