harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov" <alexei.zakha...@gmail.com>
Subject Re: [classlib] logging from within our implementation
Date Fri, 02 Jun 2006 10:25:38 GMT
For example, I failed to pass the following valid Java fragment
through the Velocity 1.4 compiler:

public static void main(String argv[]) {
    // for #foreach lovers
    String s = "I love #foreach statement";
}

2006/6/2, Geir Magnusson Jr <geir@pobox.com>:
>
>
> Alexei Zakharov wrote:
> >> Where do we have #foreach in our code?
> >
> > I suppose nowhere currently. I mean we will need to define additional
> > coding rules to avoid using of such strings in the future.
>
> Why?  velocity does a reasonable job at figuring out VTL-like things
> that aren't VTL...
>
> geir
>
> >
> >> (who wrote a significant portion of velocity...)
> >
> > Really? I had no idea about that :))
> >
> >
> > 2006/6/2, Geir Magnusson Jr <geir@pobox.com>:
> >> Prove it.
> >>
> >> geir
> >>
> >> (who wrote a significant portion of velocity...)
> >>
> >> Soeren Strassfeld wrote:
> >> > That´s true, of course!
> >> >
> >> > Alexei Zakharov schrieb:
> >> >> I worry about the situation when we got something Velocity-like in
> >> >> java code. Strings like "#foreach" or smth. like it in comments. This
> >> >> will probably break the V. compiler.
> >> >>
> >> >> 2006/6/1, Soeren Strassfeld <nc-straszso@netcologne.de>:
> >> >>> Hi Alexei,
> >> >>>
> >> >>> I think the result in both examples is quite the same, I just liked
> >> >>> the Idea to just add java comments to the code, so you don´t
> >> >>> need a precompiler as long as you build the classlib with logging
> >> >>> statements.
> >> >>>
> >> >>> Cheers,
> >> >>>  Soeren
> >> >>>
> >> >>> Alexei Zakharov schrieb:
> >> >>> > Hi Soeren,
> >> >>> >
> >> >>> > 2006/6/1, Soeren Strassfeld <nc-straszso@netcologne.de>:
> >> >>> >> How about using Velocity as Preprocessor.
> >> >>> >> You could put all logging Statements between an
> >> >>> >> //#if ($debug)
> >> >>> >> and
> >> >>> >> //#end
> >> >>> >> So the Code would stay pure java, and the debug Version
could be
> >> >>> >> compiled
> >> >>> >> without a Preprocessor.
> >> >>> >
> >> >>> > Is this something better than just using java in the same
way?
> >> >>> >
> >> >>> > static final boolean DEBUG = false;
> >> >>> > if (DEBUG) {
> >> >>> >    // wiped away by java compiler
> >> >>> >    log("my useful log message");
> >> >>> > }
> >> >>> >
> >> >>> > The problem of your approach as well as the above example
is the
> >> >>> > additional syntax you need to add to each log call.
> >> >>> >
> >> >>> > However, I like the general idea of using Velocity as a Java
> >> >>> preprocessor
> >> >>> > :)

-- 
Alexei Zakharov,
Intel Middleware Product Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message