<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Day 20 &#8211; Dynamic variables and DSL-y things</title>
	<atom:link href="http://perl6advent.wordpress.com/2012/12/20/day-20-dynamic-variables-and-dsl-y-things/feed/" rel="self" type="application/rss+xml" />
	<link>http://perl6advent.wordpress.com/2012/12/20/day-20-dynamic-variables-and-dsl-y-things/</link>
	<description>Something cool about Perl 6 every day</description>
	<lastBuildDate>Sun, 03 Feb 2013 05:15:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: carl</title>
		<link>http://perl6advent.wordpress.com/2012/12/20/day-20-dynamic-variables-and-dsl-y-things/#comment-2054</link>
		<dc:creator><![CDATA[carl]]></dc:creator>
		<pubDate>Thu, 20 Dec 2012 18:42:02 +0000</pubDate>
		<guid isPermaLink="false">http://perl6advent.wordpress.com/?p=1783#comment-2054</guid>
		<description><![CDATA[Yes! In fact, I meant to mention that in the post, but a strange (possibly work-related) tiredness overcame me and muddled my thinking before I got the chance.

So, here goes.

Yes, we can piggyback the dynamic variables to detect whether we&#039;re inside of the block. This short snippet illustrates the principle:

&lt;pre&gt;sub outer(&amp;block) {
  my @*piles;
  &amp;block()
};

sub inner {
  say @*piles;
  CATCH {
    when /Dynamic/ {
      die &quot;You can only use &amp;inner in &amp;outer&quot;
    }
  }
};

inner() # boom&lt;/pre&gt;

Using the dynamicals to detect whether we&#039;re inside of the outer block carries with it the risk of false positives (i.e. someone else declares a dynamical with the same name, causing the inner sub to think it&#039;s in the outer when it isn&#039;t). But this risk is inherent in this use of dynamicals, not in the error munging.]]></description>
		<content:encoded><![CDATA[<p>Yes! In fact, I meant to mention that in the post, but a strange (possibly work-related) tiredness overcame me and muddled my thinking before I got the chance.</p>
<p>So, here goes.</p>
<p>Yes, we can piggyback the dynamic variables to detect whether we&#8217;re inside of the block. This short snippet illustrates the principle:</p>
<pre>sub outer(&amp;block) {
  my @*piles;
  &amp;block()
};

sub inner {
  say @*piles;
  CATCH {
    when /Dynamic/ {
      die "You can only use &amp;inner in &amp;outer"
    }
  }
};

inner() # boom</pre>
<p>Using the dynamicals to detect whether we&#8217;re inside of the outer block carries with it the risk of false positives (i.e. someone else declares a dynamical with the same name, causing the inner sub to think it&#8217;s in the outer when it isn&#8217;t). But this risk is inherent in this use of dynamicals, not in the error munging.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benabik (@Benabik)</title>
		<link>http://perl6advent.wordpress.com/2012/12/20/day-20-dynamic-variables-and-dsl-y-things/#comment-2014</link>
		<dc:creator><![CDATA[Benabik (@Benabik)]]></dc:creator>
		<pubDate>Thu, 20 Dec 2012 06:04:45 +0000</pubDate>
		<guid isPermaLink="false">http://perl6advent.wordpress.com/?p=1783#comment-2014</guid>
		<description><![CDATA[Nice example.  Is is possible / easy to make the _ and o subs only available from within the block for nim?  DSLs are nice, but limiting the scope of these things to only where they&#039;re useful is better.]]></description>
		<content:encoded><![CDATA[<p>Nice example.  Is is possible / easy to make the _ and o subs only available from within the block for nim?  DSLs are nice, but limiting the scope of these things to only where they&#8217;re useful is better.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
