Comments (10)
Looking into this now...
Original comment by john.douglas.pritchard
on 4 Jun 2011 at 6:41
- Added labels: Priority-High
- Removed labels: Priority-Medium
from hapax2.
See //svn/issues/1
Original comment by john.douglas.pritchard
on 4 Jun 2011 at 6:51
- Changed state: Accepted
from hapax2.
Review - Invalid
The expectation for "<-item3->" is not true, because "{{>template}}" means
include file "template.xtm" -- and has no relation to the section named
"template".
The call stack runs out in "getVariable" within "renderSection", because each
time the template is included into itself, the variable lookup with inheritance
is performed to check that the include name, "template", is not renamed by a
variable assignment. In a sense, this "getVariable" call explores or probes
the future of the call stack in the execution of the recursion.
The dictionary tree depth at the point of inclusion is replicated or multiplied
by each inclusion. For a tree depth of X and a recursion depth of Y, the
traversal from leaf to root is X * Y -- the length of the call path taken by
"getVariable" at each recursion point to check that the include name,
"template".
So the recursive include finally blows the call stack in "getVariable".
Original comment by john.douglas.pritchard
on 4 Jun 2011 at 7:36
- Changed state: Invalid
from hapax2.
This review is not more than a reference outline. See also the recently added
comment in TemplateDictionary.java. The recursive include in memory is
reflected in the call stack recursion via "renderSection" calls.
Original comment by john.douglas.pritchard
on 4 Jun 2011 at 7:49
from hapax2.
The architecture that blows up in this way is far more efficient than the
alternative, first building the data structure in memory and then subsequently
evaluating its result. The alternative architecture would blow up in a more
intuitive way, but would be roughly twice as slow at runtime.
Original comment by john.douglas.pritchard
on 4 Jun 2011 at 7:52
from hapax2.
So, is there a way to do what I need in a proper way?
Original comment by [email protected]
on 6 Jun 2011 at 12:15
from hapax2.
This might be controlled through template naming, if the following were possible
For "template {{>x}} source"...
D a = new D();
a.setVariable("x","branch");
D b = a.add();
b.setVariable("x","leaf");
D c = b.add();
c.setVariable("x","nil");
so there's a level below leaf to turn off the template include named "x", and
an empty "nil.xtm".
tricky, but possible.
Original comment by john.douglas.pritchard
on 6 Jun 2011 at 1:12
from hapax2.
Still StackOverflowError does not seem a proper means to indicate a misuse of
the API. Possibly, another issue has to be filed to resolve this problem, does
not it?
Original comment by [email protected]
on 9 Jun 2011 at 10:57
from hapax2.
Well, ideally yes. However, a design time benefit at the cost of run time is
not considered worthwhile in this neighborhood -- where run time performance is
the purpose of this tool. Many program languages include ideas like these, but
it's not obvious to me how to get this tool to fulfill that objective without
doing injury to it.
This tool is written in the spirit of scientific computing, where the source
code is easy to read and comprehend so that the tool is readily available to
its users.
With the foundations and objectives for this tool, we'd rather document the
tool than embellish the software for additional (design time) objectives -- and
thereby obscure the tool itself. I think that the documentation is the issue,
here.
Of course, all ideas are most welcome.
Original comment by john.douglas.pritchard
on 9 Jun 2011 at 4:02
from hapax2.
Added some documentation at
http://code.google.com/p/hapax2/wiki/RecursiveInclude
All comments most welcome.
Thanks for your efforts, Ivan.
Original comment by john.douglas.pritchard
on 9 Jun 2011 at 4:36
from hapax2.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hapax2.