late Proposal: Add C-like preprocessing ability for java language.

Gabriel Belingueres belingueres at gmail.com
Tue Mar 31 17:44:29 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?

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/view_bug.do?bug_id=4165111
>  http://bugs.sun.com/view_bug.do?bug_id=4087771
>  http://bugs.sun.com/view_bug.do?bug_id=4615070
>  http://bugs.sun.com/view_bug.do?bug_id=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