You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pollen/doc/pollen/Top.html

2 lines
33 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>9.8&nbsp;Top</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="file:///Users/MB/Library/Racket/6.0.1/doc/local-redirect/local-redirect.js"></script><script type="text/javascript" src="file:///Users/MB/Library/Racket/6.0.1/doc/local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9658;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Pollen:<span class="mywbr"> &nbsp;</span> the book is a program</a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="Installation.html" class="tocviewlink" data-pltdoc="x">Installation</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="quick-tour.html" class="tocviewlink" data-pltdoc="x">Quick tour</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="Backstory.html" class="tocviewlink" data-pltdoc="x">Backstory</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="big-picture.html" class="tocviewlink" data-pltdoc="x">The big picture</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="First_tutorial.html" class="tocviewlink" data-pltdoc="x">First tutorial</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="raco-pollen.html" class="tocviewlink" data-pltdoc="x">Using <span class="stt">raco pollen</span></a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="File_formats.html" class="tocviewlink" data-pltdoc="x">File formats</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="reader.html" class="tocviewlink" data-pltdoc="x">&#9674; command overview</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="Module_reference.html" class="tocviewselflink" data-pltdoc="x">Module reference</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="Acknowledgments.html" class="tocviewlink" data-pltdoc="x">Acknowledgments</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="License___source_code.html" class="tocviewlink" data-pltdoc="x">License &amp; source code</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_1&quot;);">&#9660;</a></td><td>9&nbsp;</td><td><a href="Module_reference.html" class="tocviewlink" data-pltdoc="x">Module reference</a></td></tr></table><div class="tocviewsublistbottom" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">9.1&nbsp;</td><td><a href="Cache.html" class="tocviewlink" data-pltdoc="x">Cache</a></td></tr><tr><td align="right">9.2&nbsp;</td><td><a href="Decode.html" class="tocviewlink" data-pltdoc="x">Decode</a></td></tr><tr><td align="right">9.3&nbsp;</td><td><a href="file-types.html" class="tocviewlink" data-pltdoc="x">File</a></td></tr><tr><td align="right">9.4&nbsp;</td><td><a href="Pagetree.html" class="tocviewlink" data-pltdoc="x">Pagetree</a></td></tr><tr><td align="right">9.5&nbsp;</td><td><a href="Render.html" class="tocviewlink" data-pltdoc="x">Render</a></td></tr><tr><td align="right">9.6&nbsp;</td><td><a href="Template.html" class="tocviewlink" data-pltdoc="x">Template</a></td></tr><tr><td align="right">9.7&nbsp;</td><td><a href="Tag.html" class="tocviewlink" data-pltdoc="x">Tag</a></td></tr><tr><td align="right">9.8&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Top</a></td></tr><tr><td align="right">9.9&nbsp;</td><td><a href="World.html" class="tocviewlink" data-pltdoc="x">World</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28form._%28%28lib._pollen%2Ftop..rkt%29._~23~25top%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">#%top</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._pollen%2Ftop..rkt%29._def%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym">def/<span class="mywbr"> &nbsp;</span>c</span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="versionbox"><span class="version">6.0.1</span></div><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.0.1&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.0.1&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="Tag.html" title="backward to &quot;9.7 Tag&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="Module_reference.html" title="up to &quot;9 Module reference&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="World.html" title="forward to &quot;9.9 World&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h4>9.8<tt>&nbsp;</tt><a name="(part._.Top)"></a><a name="(mod-path._pollen/top)"></a>Top</h4><p><table cellspacing="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">pollen/top</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">pollen</span></span></td></tr></table></p><p>You&rsquo;ll probably never invoke this module directly. But it&rsquo;s implicitly imported into every Pollen markup file. And if you don&rsquo;t know what it does, you might end up surprised by some of the behavior you get.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._pollen/top..rkt)._~23~25top))"></a><span title="Provided from: pollen/top | Package: pollen"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=__top.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25top%2529%2529&amp;version=6.0.1" class="RktStxDef Sq RktStxLink" data-pltdoc="x">#%top</a></span></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktVar">id</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">In standard Racket, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=__top.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25top%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">#%top</a></span> is the function of last resort, called when <span class="RktVar">id</span> is not bound to any value. As such, it typically reports a syntax error.</div></p><p><table cellspacing="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Let</span><span class="RktCmt">'</span><span class="RktCmt">s call em without defining it</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">em</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">em: undefined;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr">cannot reference undefined identifier</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">(em "Bonjour") is being converted to ((#%top . em) "Bonjour")</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">So calling ((#%top . em) "Bonjour") will give the same result</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=__top.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25top%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">#%top</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym">em</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">em: undefined;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr">cannot reference undefined identifier</span></p></td></tr></table></blockquote></td></tr></table></p><p>In the Pollen markup environment, however, this behavior is annoying. Because when you&rsquo;re writing X-expressions, you don&rsquo;t necessarily want to define all your tags ahead of time.</p><p>So Pollen redefines <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=__top.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25top%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">#%top</a></span>. For convenience, Pollen&rsquo;s version of <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=__top.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25top%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">#%top</a></span> assumes that an undefined tag should just refer to an X-expression beginning with that tag (and uses <span class="RktSym"><a href="Tag.html#%28def._%28%28lib._pollen%2Ftag..rkt%29._make-tag-function%29%29" class="RktValLink" data-pltdoc="x">make-tag-function</a></span> to provide this behavior):</p><p><table cellspacing="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Again, let</span><span class="RktCmt">'</span><span class="RktCmt">s call em without defining it, but using pollen/top</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktSym">pollen/top</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">em</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(em "Bonjour")</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">(em "Bonjour") is still being converted to ((#%top . em) "Bonjour")</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">But now, ((#%top . em) "Bonjour") gives a different result</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=__top.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25top%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">#%top</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym">em</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(em "Bonjour")</span></p></td></tr></table></blockquote></td></tr></table></p><p>The good news is that this behavior means you use any tag you want in your markup without defining it in advance. You can still attach a function to the tag later, which will automatically supersede <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=__top.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25top%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">#%top</a></span>.</p><p><table cellspacing="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">em</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">span</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">(</span><span class="RktVal">style</span><span class="hspace">&nbsp;</span><span class="RktVal">"font-size:100px"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktRdr">,</span><span class="RktSym">x</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">em</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(span ((style "font-size:100px")) "Bonjour")</span></p></td></tr></table></blockquote></td></tr></table></p><p>The bad news is that you&rsquo;ll never get an &ldquo;undefined identifier&rdquo; error. These undefined identifiers will happily sail through and be converted to tags.</p><p><table cellspacing="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktSym">pollen/top</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">em</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym">xs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">span</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">(</span><span class="RktVal">style</span><span class="hspace">&nbsp;</span><span class="RktVal">"font-size:100px"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktRdr">,@</span><span class="RktSym">xs</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">There</span><span class="RktCmt">'</span><span class="RktCmt">s a typo in my tag</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">erm</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(erm "Bonjour")</span></p></td></tr></table></blockquote></td></tr></table></p><p>This isn&rsquo;t a bug. It&rsquo;s just a natural consequence of how Pollen&rsquo;s <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=__top.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25top%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">#%top</a></span> works. It can, however, make debugging difficult sometimes. Let&rsquo;s suppose my markup depends on <span class="RktSym">very-important-function</span>, which I don&rsquo;t import correctly.</p><p><table cellspacing="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktSym">pollen/top</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><table cellspacing="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=module.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._module%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">module</a></span><span class="hspace">&nbsp;</span><span class="RktSym">vif</span><span class="hspace">&nbsp;</span><span class="RktSym">racket/base</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">very-important-function</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym">xs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">secrets-of-universe</span><span class="hspace">&nbsp;</span><span class="RktRdr">,@</span><span class="RktSym">xs</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Forgot to (require </span><span class="RktCmt">'</span><span class="RktCmt">vif)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">very-important-function</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(very-important-function "Bonjour")</span></p></td></tr></table></blockquote></td></tr></table></p><p>So the undefined-function bug goes unreported. Again, that&rsquo;s not a bug in Pollen &#8212;&#160;there&rsquo;s just no way for it to tell the difference between an identifier that&rsquo;s deliberately undefined and one that&rsquo;s inadvertently undefined. If you want to guarantee that you&rsquo;re invoking a defined identifier, use <span class="RktSym">def/c</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._pollen/top..rkt)._def/c))"></a><span title="Provided from: pollen/top | Package: pollen"><span class="RktSym"><span class="RktSymDef RktSym">def/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktVar">id</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Invoke <span class="RktVar">id</span> if it&rsquo;s a defined identifier, otherwise raise an error. This form reverses the behavior of <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=__top.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25top%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">#%top</a></span> (in other words, it restores default Racket behavior).</div></p><p>Recall this example from before. In standard Racket, you get an undefined-identifier error.</p><p><table cellspacing="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" class="RktBlk"><tr><td><table cellspacing="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=module.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._module%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">module</a></span><span class="hspace">&nbsp;</span><span class="RktSym">vif</span><span class="hspace">&nbsp;</span><span class="RktSym">racket/base</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">very-important-function</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym">xs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">secrets-of-universe</span><span class="hspace">&nbsp;</span><span class="RktRdr">,@</span><span class="RktSym">xs</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Forgot to (require </span><span class="RktCmt">'</span><span class="RktCmt">vif)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">very-important-function</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">very-important-function: undefined;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr">cannot reference undefined identifier</span></p></td></tr></table></blockquote></td></tr></table></p><p>But with <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">pollen/top</span></a>, the issue is not treated as an error.</p><p><table cellspacing="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktSym">pollen/top</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><table cellspacing="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=module.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._module%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">module</a></span><span class="hspace">&nbsp;</span><span class="RktSym">vif</span><span class="hspace">&nbsp;</span><span class="RktSym">racket/base</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">very-important-function</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym">xs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">secrets-of-universe</span><span class="hspace">&nbsp;</span><span class="RktRdr">,@</span><span class="RktSym">xs</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Forgot to (require </span><span class="RktCmt">'</span><span class="RktCmt">vif)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">very-important-function</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(very-important-function "Bonjour")</span></p></td></tr></table></blockquote></td></tr></table></p><p>By adding <span class="RktSym">def/c</span>, we restore the usual behavior, guaranteeing that we get the defined version of <span class="RktSym">very-important-function</span> or nothing.</p><p><table cellspacing="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktSym">pollen/top</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><table cellspacing="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=module.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._module%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">module</a></span><span class="hspace">&nbsp;</span><span class="RktSym">vif</span><span class="hspace">&nbsp;</span><span class="RktSym">racket/base</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.0.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.0.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">very-important-function</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym">xs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">secrets-of-universe</span><span class="hspace">&nbsp;</span><span class="RktRdr">,@</span><span class="RktSym">xs</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Forgot to (require </span><span class="RktCmt">'</span><span class="RktCmt">vif)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym">def/c</span><span class="hspace">&nbsp;</span><span class="RktSym">very-important-function</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bonjour"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">very-important-function: undefined;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr">cannot reference undefined identifier</span></p></td></tr></table></blockquote></td></tr></table></p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.0.1&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.0.1&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="Tag.html" title="backward to &quot;9.7 Tag&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="Module_reference.html" title="up to &quot;9 Module reference&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="World.html" title="forward to &quot;9.9 World&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>