late Proposal: Add C-like preprocessing ability for java language. (original) (raw)

rssh at gradsoft.com.ua rssh at gradsoft.com.ua
Tue Mar 31 23:47:07 PDT 2009


Hmm the preprocessor is a very powerful tool. But IIRC (back in the '90s) wasn't one of the initial design goals (strength?) of Java to never have a C like preprocessor? Can it be changed now?

As I remeber, the initial design goal of Java was be language for writing applets (embeddable client-side dynamic content on web pages). Is this changed now ?

2009/3/31 <rssh at gradsoft.com.ua>:

Sorry for late, but I was waiting for stars be in correct location for sending this.

OVERVIEW: ═FEATURE SUMMARY: Add C-like preproceeding ability to Java language. ═MAJOR ADVANTAGE: ═ Possibility implements language extensions, such as sugaring/desugaring, koffein/dekoffein outside of Sun, fix bugs 4411102, 6439965, 4649007 and many others from sun bugs database and increase team building importance for Java programmers by providing ability to any engineer tune life of all team in night ware. Of course, this possibility exists in current version of JAVA, but it's too rare used. Often rewriting of software system from scratch will speed-up economics, which is important for faster recovery from crisis. ═MAJOR DISADVANTAGE ═ Inaccurate usage of this feature can cause producing of unmaintainable code. ═ALTERNATIVES: ═ Use external preprocessing tool. EXAMPLES SIMPLE EXAMPLE: ═System.out.println("file is %s, line is %d\n ",FILE,LINE); ADVANCED EXAMPLE: ARM Proposal can be implemented on user level without language changes. _#define TRY(xt,x,y,z) xt x=null; try{ ═ ═ ═_ _═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═x=y ; ═ _ _═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═z ; ═ ═ _ _═ ═ ═ ═ ═ ═ ═ ═ ═ ═} finally { _ _═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═x.close() _ _═ ═ ═ ═ ═ ═ ═ ═ ═ ═} _

_TRY(sqlConnection, cn, dataSource.getConnection(), _ _═ ═ ═RecordSet rs = _ _═ ═ ═ cn.evaluateQuery("select * from customers where id=:x",2); _ ═ ═ ═while(rs.next()) { printRow(rs); } ) will be desugared as sqlConnection cn=null; try{ ═cn = dataSource.getConnection(); ═RecordSet rs = ═ ═ ═ cn.evaluateQuery("select * from customers where id=:x",2); ═ ═ ═while(rs.next()) { printRow(rs); } ═}finally{ ═ ═cn.close(); ═} DETAILS: ═No details required. COMPILATION: ═No changes to compiler required, all is do on preprocessor level. TESTING: ═We can reuse tested implelementation of C preporcessor. LIBRARY SUPPORT: ═It would be good add gcc distribution to java. REFLECTIVE APIS: None OTHER CHANGES: None MIGRATION: None COMPABILITY ═None REFERENCES http://bugs.sun.com/viewbug.do?bugid=4165111 http://bugs.sun.com/viewbug.do?bugid=4087771 http://bugs.sun.com/viewbug.do?bugid=4615070 http://bugs.sun.com/viewbug.do?bugid=4215781 IMPLEMENTATION PROTOTYPE URL See http://gcc.gnu.org Also exists java-only solutions for embedding http://www.duo-creative.com/chrisb/jpp/



More information about the coin-dev mailing list