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
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.