Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Question about @Pure annotation
Question about @Pure annotation [message #986470] Tue, 20 November 2012 15:00 Go to next message
András Ökrös is currently offline András ÖkrösFriend
Messages: 7
Registered: July 2009
Junior Member

We came across the @Pure annotation in xbase.lib, and it seems it is similar to the validation feature we are trying to achieve. Can you tell me how is this annotation used in xbase? Or is there some documentation or example about it we have missed?

Are you planning to extend it somehow to cover other side-effect free parts of the java language (like java.lang.Math)?

Thanks in advance for the answer!
Best regards, András Ökrös
Re: Question about @Pure annotation [message #987184 is a reply to message #986470] Sat, 24 November 2012 09:50 Go to previous message
Istvan Rath is currently offline Istvan RathFriend
Messages: 59
Registered: July 2009
Yesterday, Zoltan Ujhelyi and I had a nice chat with Moritz Eysholdt from Itemis on this topic. The short answer to the question is as follows:
1) @Pure is used to indicate pure functions (e.g. xbase operators) whose behavior only depends on their inputs (they are deteministic)
2) the @Pure annotation is used to validate Xbase expressions, i.e. check them for being side-effect-free; we have also identified some parts in the code generator where some additional comment is being generated (the exact purpose of this is unclear, maybe we should ask Sven Efftinge as he seems to be the author of that code)

Moritz told us that currently the only way of extending @Pure to other classes is to use the annotation itself on code you'd like to mark as being pure. We discussed an idea whereby a white-list could be added to the system (perhaps through an extension point) that would allow programmers to use namespace wildcards for marking code (i.e. standard parts of java.lang etc) as being pure. We agreed that the IncQuery developer team will propose a bugzilla and a patch for this and from then they'll see whether this is acceptable for them.
Previous Topic:Qualified Quick Fix labels
Next Topic:Refer the value of one feature inside the rule
Goto Forum:

Current Time: Tue Sep 29 12:19:13 GMT 2020

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

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

Back to the top