On Thu, Nov 9, 2023 at 6:40 PM Taher Alkhateeb <ta...@pythys.com.invalid> wrote:
Hi Taher, > I'm a little confused. Why aren't we joining efforts on the apache version? Well, in an ideal world, that is what would happen, yes. But this is hardly an ideal situation. > Why make it "a pity if a wider group of > people never get the benefit of this work"? Am I missing something too > obvious or too old or something? Is this code base completely incompatible? > Is this a technical issue? > There is a technical issue, a very big one, that I shall explain below. However, that said, the problem here is not exclusively technical.... Well, I reckon that hardly anybody here really understands that "Apache FreeMarker" is a continuation of the FreeMarker 2.3.x codebase that really, by all rights, reached the end of the line at some point in 2005, at the latest. Any subsequent work in the SVN trunk ("trunk" being what is called in Git "master" or nowadays "main") was, in principle, the main line of development for the 2.4 release cycle. (Or possibly it was going to eventually be labeled 3.0.) All the work that I myself did in 2006, 2007, and 2008 was in the SVN trunk. For reasons that I can only speculate about, when Daniel Dekany took the FreeMarker code to Apache, he took the 2.3.x maintenance branch, not the trunk of the code, i.e. the main line of development. As for why he did this, you'd have to ask Daniel. As I explained in the previous message, I picked up my older parser generator work (a fork and eventually a total rewrite of JavaCC) again at the end of 2019 and that work had always used the newer version of FreeMarker (that Daniel abandoned for whatever reason). So all improvements to FreeMarker that I have made over the last few months were built on top of the 2.4.x codebase. For example, here specifically is an example from the wishlist for the vaporware FreeMarker 3 here https://cwiki.apache.org/confluence/display/FREEMARKER/FreeMarker+3 "Replace #assign/#global/#local with #var/#set. Allow block-scope variables. [Status: Not done]" Okay, it is still unimplemented in Apache FreeMarker. Now, I believe I mentioned this feature in the announcement. In any case, it is described here: https://github.com/freemarker/freemarker3/wiki/Strict-Vars But here is the real point. This is NOT something that I added recently. I implemented this back in 2008(!) (Or possibly earlier!) Interestingly, there was actually one preview release of 2.4, labeled "2.4 preview 1" that was released on 16 July 2008. And that definitely had #var/#set in it. Funny, that release is only mentioned on the Russian language wikipedia page. See the sidebar here: https://ru.wikipedia.org/wiki/FreeMarker Okay, probably most of you can't read Russian, but the sidebar mentions the latest development release as being 2.4 preview 1, and the date there is 16 July 2008. I mean, all of this is really ancient history. The version of FreeMarker that is used internally in CongoCC has had #set/#var from the very beginning. (That project actually existed back in 2008 but was called FreeCC.) In any case, if you look at the main FM template for generating grammar productions in CongoCC here https://github.com/congo-cc/congo-parser-generator/blob/main/src/templates/java/ParserProductions.java.ftl you can see that all the variable assignments use the "new" (I put that in scare quotes) #set/#var and there is no #assign or #local anywhere (in that template or any of the others) and that has been the case from project's beginnings back in 2008. But hopefully, you can understand the implications of what I'm telling you. Apache FreeMarker, now in 2023 (soon 2024) is still missing features that were in the FreeMarker codebase in 2008! 15 years ago! And it's not just #set/#var. The more advanced version of FreeMarker exposes an API for accessing the AST (abstract syntax tree) of a parsed template and that facilitates all kinds of things that would be very hard (maybe impossible) to do against the 2.3.x codebase. Well, anyway, the FreeMarker 3 that I recently announced is based on continued work on what was really the main line of development, the SVN trunk. There was quite a bit of radical change in the 2006-2008 time period and the 2.4 (now 3.0) codebase is simply not compatible with the older 2.3 branch, which is what Apache FreeMarker really is. Anyway, what I describe above is the technical side of the conversation. The non-technical side of things is that it's just not very appealing to try to collaborate with this "community". I put in enough work on this thing and I would like to reactivate the project into something real instead of the nothingburger project that it currently is. (The nothingburger concept is something that I explained in this essay: https://wiki.parsers.org/doku.php?id=nothingburger and if you want to understand how I perceive this situation, you would do well to read that.). So, if there are people lurking who are sick of all the nothingburger-ism and want to get involved in some real software development, by all means, drop me a note or start a conversation here: https://github.com/freemarker/freemarker3/discussions I hope the foregoing clears up some of your (understandable) confusion about the situation. Best Regards, Jonathan Revusky > > Taher Alkhateeb > > On Wednesday, November 08, 2023 04:03 +03, Jonathan Revusky < > revu...@gmail.com> wrote: > Greetings, > > I thought to let people know that there is a vastly more advanced version > of FreeMarker available here: https://github.com/freemarker/freemarker3 > > You can build it via: > > git clone https://github.com/freemarker/freemarker3.git > cd freemarker3 > ant > > Or, if you want, there is a prebuilt jarfile you can grab here: > https://parsers.org/download/freemarker.jar > > Though it is actually a rather superficial new feature, I think that one > thing that people will enjoy is the new terser syntax. Basically, if a > directive starts a line (aside from whitespace) there is no need for any > pointy (or square) brackets. So you can just write: > > #if foo == bar > blah blah > /#if > > You can look here for a more complete description: > https://github.com/freemarker/freemarker3/wiki/Terse-Syntax and here is an > example of a template from the old test suite rewritten using the terser > syntax: > > https://github.com/freemarker/freemarker3/blob/master/src/freemarker/testcase/template/test-switch.html > > In this version of FreeMarker, the #assign and #local directives (though > they still work in a backward-compatible mode) were replaced with the newer > #var and #set. This is (IMHO) a significant improvement and is described > here: https://github.com/freemarker/freemarker3/wiki/Strict-Vars > > Just generally speaking though, the biggest changes are really under the > hood and would not be so visible to the casual user. This FreeMarker > codebase has been refactored so that it largely does away with all of those > TemplateXXXModel wrappers and mostly just directly uses POJOs. (Plain Old > Java Objects.) This is described here: > https://github.com/freemarker/freemarker3/wiki/Under-the-Hood > > Various longstanding annoyances, like not being able to directly use a map > with non-string keys, have been addressed. > > Oh, it suddenly occurs to me that many (perhaps most) people on this > mailing list do not know who I am. I am effectively the original author of > FreeMarker. I say "effectively" because there was a FreeMarker 1.x, which > was really little more than a weekend hack. The version that 99% of > FreeMarker users have used, which is 2.x, was a complete rewrite and is > largely my work. > > As for other questions about what is going on with this, for example, why I > have put some renewed effort into FreeMarker after all years... well, my > main open source efforts have been going into my rewrite of that old JavaCC > parser generator that FreeMarker 2.x was originally built with. The new > version of JavaCC was originally called FreeCC, then when I resuscitated it > a few years ago, I called it JavaCC 21, but it is now rebranded as CongoCC. > So, since FreeMarker is a key part of CongoCC, I found myself adding the > occasional new feature to FreeMarker (my own version, not Apache > FreeMarker). For example, the feature described here > https://github.com/freemarker/freemarker3/wiki/Macros-as-Functions was > added to support CongoCC development back in 2020, but probably a lot of > FreeMarker users would appreciate this. > > So, at some point, I did rework FreeMarker to use CongoCC instead of the > legacy JavaCC. CongoCC is a much, much more powerful parser generator than > the original JavaCC, so it makes FreeMarker development comparatively a > breeze. For example, I quite recently implemented assertions in FreeMarker > and this is where it is implemented: > > https://github.com/freemarker/freemarker3/blob/master/src/parser/Directives.inc.ccc#L417-L445 > > Or here is where ternary expressions are implemented: > > https://github.com/freemarker/freemarker3/blob/master/src/parser/Expressions.inc.ccc#L98-L118 > You really should compare the FreeMarker grammar expressed with CongoCC to > the one that was written with legacy JavaCC, that is here: > https://github.com/apache/freemarker/blob/2.3-gae/src/main/javacc/FTL.jj > > So I rewrote FreeMarker (it is largely a rewrite at this point) to: (a) > have a better tool for CongoCC development and (b) to provide a showcase > for CongoCC's capabilities. > > As for my plans, well, I do think it would be a pity if a wider group of > people never get the benefit of this work. Whether I intend to call this > version of FreeMarker "FreeMarker 3" or rename it to "Congo Templates", I > still haven't decided about that. I really only put some serious effort > into the FreeMarker codebase starting this summer and the work kind of took > on a life of its own. > > In any case, anybody who is interested in getting involved, by all means. > Maybe start a discussion here: > https://github.com/freemarker/freemarker3/discussions > > Best Regards and Greetings from Spain, > > Jonathan Revusky >