Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsQuestion about @Pure annotation
https://www.eclipse.org/forums/index.php/mv/msg/440396/986470/#msg_986470
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]]>András Ökrös2012-11-20T15:00:01-00:00Re: Question about @Pure annotation
https://www.eclipse.org/forums/index.php/mv/msg/440396/987184/#msg_987184
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.
]]>Istvan Rath2012-11-24T09:50:08-00:00