rototor opened a new pull request #67: URL: https://github.com/apache/freemarker/pull/67
Using this setting allows files to be only included and interpreted once. This is the freemarker equivalent of MS C++ ```[#pragma once]```. Which was a fix for the common C-header pattern: ``` [#ifndef MYFILE_H] [#define MYFILE_H] ... rest of myfile.h [#endif] ``` This looks in freemarker like that: ``` <#if !(MYFILE_INCLUDED!false> <#assign MYFILE_INCLUDED=true> ... rest of myfile </#if> ``` which of course is also very ugly. As a freemarker project gets bigger and more complex many lib templates containing only macros and functions arise. And the same old C++ problems with it: Those libs depend on each other, some include the required other libs explicit, some just assume they have already be included. Which of course causes problems from time to time. Using ```<#ftl onlyIncludeOnce=true>``` allows to always explicit specify the dependencies without getting a runtime penalty or some unwanted side effect (e.g. reset of global variables) from it. The name onlyIncludeOnce should match the other setting names. But feel free to suggest another name for the setting. I'm also not quite sure how to do a test for this here. I used the ExampleTest as base for this, as it just did what I needed. But it's from the manual package, and I'm using it in core here... Not really that clean. Note: I already have a Apache CLA signed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
