Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XBase: Overloading '.' operations
XBase: Overloading '.' operations [message #1766185] Sat, 17 June 2017 06:38 Go to next message
Amit Yadav is currently offline Amit YadavFriend
Messages: 28
Registered: June 2017
Junior Member
Hello,

I am trying to figure out if there is a way to override the meaning of '.' operation for a specific java type.

In my DSL I am using a java type which is essentially a Map<String, Object>. What I would like to achieve is that a call to a.field on an object of this type in my DSL could be translated to 'a.get(field)' in my JvmModelInferrer.Similarly an assignment to a.field = blah translates to a.put(field, blah).

Wondering if this is possible with XBase.
Re: XBase: Overloading '.' operations [message #1766230 is a reply to message #1766185] Mon, 19 June 2017 01:43 Go to previous messageGo to next message
Amit Yadav is currently offline Amit YadavFriend
Messages: 28
Registered: June 2017
Junior Member
One idea would be in the inferrer detect the XMemberFeatureCall where such usage are happening and then replace that with a newer XExpression.

1) Is it possible to create new XExpressions in the inferrer code ?
2) does this sound like a good idea ?

Thanks,

Amit
Re: XBase: Overloading '.' operations [message #1766254 is a reply to message #1766230] Mon, 19 June 2017 14:07 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
1) The general idea kind of contradicts strict typing, which is inherent in Xbase and Java.
2) The '.' operator is already very overloaded.
3) Changing expressions in the inferrer sounds bad as well. A better location seems to be feature scoping and the compiler, but that could be pretty tricky as well.

Summing up, I'd rather not implement that.


---
Get professional support from the Xtext committers at www.typefox.io
Re: XBase: Overloading '.' operations [message #1766273 is a reply to message #1766254] Mon, 19 June 2017 17:56 Go to previous message
Amit Yadav is currently offline Amit YadavFriend
Messages: 28
Registered: June 2017
Junior Member
Thank you Jan.
Previous Topic:Parsing inmemory text using Xtext outside of Eclipse
Next Topic:Xtext 2.12 what emf version are used
Goto Forum:
  


Current Time: Tue Sep 28 20:07:39 GMT 2021

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

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

Back to the top