diff options
Diffstat (limited to 'docs/html/dev_guide/design.html')
-rw-r--r-- | docs/html/dev_guide/design.html | 214 |
1 files changed, 0 insertions, 214 deletions
diff --git a/docs/html/dev_guide/design.html b/docs/html/dev_guide/design.html deleted file mode 100644 index 717174e..0000000 --- a/docs/html/dev_guide/design.html +++ /dev/null @@ -1,214 +0,0 @@ - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>Design Decisions and Tradeoffs — Cheetah3 - The Python-Powered Template Engine</title> - <link rel="stylesheet" href="../_static/sphinxdoc.css" type="text/css" /> - <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT: '../', - VERSION: '3.1.0', - COLLAPSE_INDEX: false, - FILE_SUFFIX: '.html', - HAS_SOURCE: true, - SOURCELINK_SUFFIX: '.txt' - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - <link rel="index" title="Index" href="../genindex.html" /> - <link rel="search" title="Search" href="../search.html" /> - <link rel="next" title="Safe Delegation" href="safeDelegation.html" /> - <link rel="prev" title="Directives: Flow Control" href="flowControl.html" /> - </head> - <body> - <div class="related" role="navigation" aria-label="related navigation"> - <h3>Navigation</h3> - <ul> - <li class="right" style="margin-right: 10px"> - <a href="../genindex.html" title="General Index" - accesskey="I">index</a></li> - <li class="right" > - <a href="../py-modindex.html" title="Python Module Index" - >modules</a> |</li> - <li class="right" > - <a href="safeDelegation.html" title="Safe Delegation" - accesskey="N">next</a> |</li> - <li class="right" > - <a href="flowControl.html" title="Directives: Flow Control" - accesskey="P">previous</a> |</li> - <li class="nav-item nav-item-0"><a href="../index.html">Cheetah3 - The Python-Powered Template Engine</a> »</li> - <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Cheetah Developer’s Guide</a> »</li> - </ul> - </div> - <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> - <div class="sphinxsidebarwrapper"> - <h3><a href="../index.html">Table Of Contents</a></h3> - <ul> -<li><a class="reference internal" href="#">Design Decisions and Tradeoffs</a><ul> -<li><a class="reference internal" href="#delimiters">Delimiters</a></li> -<li><a class="reference internal" href="#late-binding">Late binding</a></li> -<li><a class="reference internal" href="#caching-framework">Caching framework</a></li> -<li><a class="reference internal" href="#webware-compatibility-and-the-transaction-framework">Webware compatibility and the transaction framework</a></li> -<li><a class="reference internal" href="#single-inheritance">Single inheritance</a></li> -</ul> -</li> -</ul> - - <h4>Previous topic</h4> - <p class="topless"><a href="flowControl.html" - title="previous chapter">Directives: Flow Control</a></p> - <h4>Next topic</h4> - <p class="topless"><a href="safeDelegation.html" - title="next chapter">Safe Delegation</a></p> - <div role="note" aria-label="source link"> - <h3>This Page</h3> - <ul class="this-page-menu"> - <li><a href="../_sources/dev_guide/design.rst.txt" - rel="nofollow">Show Source</a></li> - </ul> - </div> -<div id="searchbox" style="display: none" role="search"> - <h3>Quick search</h3> - <form class="search" action="../search.html" method="get"> - <div><input type="text" name="q" /></div> - <div><input type="submit" value="Go" /></div> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> -</div> -<script type="text/javascript">$('#searchbox').show(0);</script> - </div> - </div> - - <div class="document"> - <div class="documentwrapper"> - <div class="bodywrapper"> - <div class="body" role="main"> - - <div class="section" id="design-decisions-and-tradeoffs"> -<h1>Design Decisions and Tradeoffs<a class="headerlink" href="#design-decisions-and-tradeoffs" title="Permalink to this headline">¶</a></h1> -<p>(design)</p> -<div class="section" id="delimiters"> -<h2>Delimiters<a class="headerlink" href="#delimiters" title="Permalink to this headline">¶</a></h2> -<p>(design.Delimiters)</p> -<p>One of the first decisions we encountered was which delimiter -syntax to use. We decided to follow Velocity’s {$placeholder} and -{#directive} syntax because the former is widely used in other -languages for the same purpose, and the latter stands out in an -HTML or text document. We also implemented the -<code class="docutils literal"><span class="pre">${longPlaceholder}</span></code> syntax like the shells for cases where -Cheetah or you might be confused where a placeholder ends. Tavis -went ahead and made <code class="docutils literal"><span class="pre">${longPlaceholder}</span></code> and -<code class="docutils literal"><span class="pre">$[longPlaceholder]</span></code> interchangeable with it since it was trivial -to implement. Finally, the {#compiler} directive allows you to -change the delimiters if you don’t like them or if they conflict -with the text in your document. (Obviously, if your document -contains a Perl program listing, you don’t necessarily want to -backslash each and every {$} and {#}, do you?)</p> -<p>The choice of comment delimiters was more arbitrary. {##} and {#* -… *#} doesn’t match any language, but it’s reminiscent of Python -and C while also being consistent with our “{#} is for directives” -convention.</p> -<p>We specifically chose { not} to use pseudo HTML tags for -placeholders and directives, as described more thoroughly in the -Cheetah Users’ Guide introduction. Pseudo HTML tags may be easier -to see in a visual editor (supposedly), but in text editors they’re -hard to distinguish from “real” HTML tags unless you look closely, -and they’re many more keystrokes to type. Also, if you make a -mistake, the tag will show up as literal text in the rendered HTML -page where it will be easy to notice and eradicate, rather than -disappearing as bogus HTML tags do in browsers.</p> -</div> -<div class="section" id="late-binding"> -<h2>Late binding<a class="headerlink" href="#late-binding" title="Permalink to this headline">¶</a></h2> -<p>(design.lateBinding)</p> -<p>One of Cheetah’s unique features is the name mapper, which lets you -write {$a.b} without worrying much about the type of {a} or {b}. -Prior to version 0.9.7, Cheetah did the entire NameMapper lookup at -runtime. This provided maximum flexibility at the expense of speed. -Doing a NameMapper lookup is intrinsically more expensive than an -ordinary Python expression because Cheetah has to decide what type -of container {a} is, whether the the value is a function (autocall -it), issue the appropriate Python incantation to look up {b} in it, -autocall again if necessary, and then convert the result to a -string.</p> -<p>To maximize run-time (filling-time) performance, Cheetah 0.9.7 -pushed much of this work back into the compiler. The compiler -looked up {a} in the searchList at compile time, noted its type, -and generated an eval’able Python expression based on that.</p> -<p>This approach had two significant drawbacks. What if {a} later -changes type before a template filling? Answer: unpredictable -exceptions occur. What if {a} does not exist in the searchList at -compile time? Answer: the template can’t compile.</p> -<p>To prevent these catastrophes, users were required to prepopulate -the searchList before instantiating the template instance, and then -not to change {a}’s type. Static typing is repugnant in a dynamic -language like Python, and having to prepopulate the searchList made -certain usages impossible. For example, you couldn’t instantiate -the template object without a searchList and then set {self} -attributes to specify the values.</p> -<p>After significant user complaints about the fragility of this -system, Tavis rewrote placeholder handling, and in version 0.9.8a3 -(August 2001), Tavis moved the name mapper lookup back into -runtime. Performance wasn’t crippled because he discovered that -writing a C version of the name mapper was easier than anticipated, -and the C version completed the lookup quickly. Now Cheetah had -“late binding”, meaning the compiler does not look up {a} or care -whether it exists. This allows users to create {a} or change its -type anytime before a template filling.</p> -<p>The lesson we learned is that it’s better to decide what you want -and then figure out how to do it, rather than assuming that certain -goals are unattainable due to performance considerations.</p> -</div> -<div class="section" id="caching-framework"> -<h2>Caching framework<a class="headerlink" href="#caching-framework" title="Permalink to this headline">¶</a></h2> -<p>(design.cache)</p> -</div> -<div class="section" id="webware-compatibility-and-the-transaction-framework"> -<h2>Webware compatibility and the transaction framework<a class="headerlink" href="#webware-compatibility-and-the-transaction-framework" title="Permalink to this headline">¶</a></h2> -<p>(design.webware)</p> -</div> -<div class="section" id="single-inheritance"> -<h2>Single inheritance<a class="headerlink" href="#single-inheritance" title="Permalink to this headline">¶</a></h2> -<p>(design.singleInheritance)</p> -</div> -</div> - - - </div> - </div> - </div> - <div class="clearer"></div> - </div> - <div class="related" role="navigation" aria-label="related navigation"> - <h3>Navigation</h3> - <ul> - <li class="right" style="margin-right: 10px"> - <a href="../genindex.html" title="General Index" - >index</a></li> - <li class="right" > - <a href="../py-modindex.html" title="Python Module Index" - >modules</a> |</li> - <li class="right" > - <a href="safeDelegation.html" title="Safe Delegation" - >next</a> |</li> - <li class="right" > - <a href="flowControl.html" title="Directives: Flow Control" - >previous</a> |</li> - <li class="nav-item nav-item-0"><a href="../index.html">Cheetah3 - The Python-Powered Template Engine</a> »</li> - <li class="nav-item nav-item-1"><a href="index.html" >Cheetah Developer’s Guide</a> »</li> - </ul> - </div> - <div class="footer" role="contentinfo"> - © Copyright 2017, Oleg Broytman; 2009-2012, R. Tyler Croy; 2001-2008, The Cheetah Development Team.. - Last updated on Mar 03, 2018. - Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.5. - </div> - </body> -</html>
\ No newline at end of file |