On Wed, Mar 06, 2002 at 01:55:25AM -0000, James Strachan wrote:
... 
> So the aim of the preprocessor would be to allow us to add some syntax
> suguar to Java to save us some typing and avoid redundancy. I just wondered
> what others thoughts are. Here's a couple of ideas for some syntax sugar...
... 
> foreach?
> ======
> To help avoid repetive code of the form...
> 
> for ( Iterator iter = something.iterator(); iter.hasNext(); ) {
>     Foo foo = (Foo) iter.next();
>     foo.bar();
> }
> 
> maybe introduce a C#-like foreach statement...
> 
> foreach( Foo foo in something.iterator() ) {
>     foo.bar();
> }

and maybe throw in some logging syntax, which can be compiled to log4j,
the Commons logger or compiled out altogether.


--Jeff

(who once did write a preprocessor to let you embed declarative XML
statements like <debug level="1">This is a debug statement</debug> in
Java. It worked by converting the marked up .java to XML, then applying
stylesheets ala XSP to transform <debug> to code, then stripping the XML
tags to get .java again. I thought it was neat :)


> 
> 
> Just thinking aloud here (as always ;-). Thoughts?
> 
> James
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to