Conditional Compilation Though Compile time variable / parameters / fields / functions Annotation

Suminda Dharmasena sirinath at
Mon Apr 15 23:47:51 PDT 2013


I think the compiler can eliminate code based on final fields. I think it
makes sense to add an annotation to maker variable / parameters / fields /
functions as compile time only. At some point the compiler should be able
to determine the code path or value of the marked constructs through static
analysis and replace the code as appropriate. Other than parameters once
compiled the constructs will not be part of the class file. For determined
literals the compiler will replace the function call with
an appropriate generated function at the point of calling. If a function is
marked as compile type only the return value is determined through static
analysis and the function is eliminated from point of calling. If private
the function is removed altogether.

If the code path or call param elimination or return values cannot
be statically determined the compiler should generate a warning and ignore
the tag.

Aside from this an annotation for compile time inlining is desirable.

This will give java an enhanced conditional compilation mechanism.

Suminda Sirinath Salpitikorala Dharmasena, B.Sc. Comp. & I.S. (Hon.) Lond.,
P.G.Dip. Ind. Maths. J'Pura, MIEEE, MACM, CEO Sakrīō! ▣ *Address*: 6G • 1st
Lane • Pagoda Road • Nugegoda 10250 • Sri Lanka. ▣ *Tele*: +94-(0)11-5
864614 / 5 875614 / 2 825908 ▣ *Web*: ▣

This email is subjected to the email Terms of Use and Disclaimer: Please read this first.
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the compiler-dev mailing list