<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">

<channel>
<title><![CDATA[Perl 6: SMOP Code Implementation]]></title>
<link>http://www.perlfoundation.org/perl6/index.cgi?smop_code_implementation</link>
<description></description>
<pubDate>Sat, 16 Aug 2008 16:56:52 -0000</pubDate>
<webMaster>synedra@gmail.com</webMaster>
<generator>Socialtext Workspace v2.14.7.2</generator>

<item>
<title><![CDATA[SMOP Code Implementation]]></title>
<link>http://www.perlfoundation.org/perl6/index.cgi?smop_code_implementation</link>
<description><![CDATA[<div class="wiki">
<p>
Code is the object responsible for invoking a specific chunk of code inside a specific lexical scope. Every code object has an &quot;outer scope&quot;, which may be the file's scope.</p>
<p>
In Perl 6, every block is a closure, so the Code object can only be initialized with the proper outer scope that is dinamically defined when the containing block is executed.</p>
<p>
Every block also has a Signature, the default block signature is ($_ is rw = OUTER::&lt;$_&gt;), as discussed in <a href="http://www.perlfoundation.org/perl6/index.cgi?smop_lexical_scope_implementation" title="(58 months) One first hard step in implementing lexical scopes is to put together a lot of details that are spre...">SMOP Lexical Scope Implementation</a>.</p>
<p>
The current implementation of block uses mold as the &quot;source code&quot;.</p>
<h2 id="modelling">Modelling</h2>
<p>
This is the structure of the Code object.</p>
<pre>
class Code {
  has $.outer;
  has $.signature = :($_ is rw = OUTER::&lt;$_&gt;);
  has Mold $.mold;
  method postcircumfix:&lt;()&gt; ($invocation_capture) {
    my $inner_scope = LexicaScope.new();
    $inner_scope.outer = $.outer;
    $.signature.BIND($invocation_capture, $inner_scope);
    my $frame = MoldFrame.new($.mold);
    $frame.set_reg(0, $inner_scope);
    $frame();
  }
}
</pre>
</div>
]]></description>
<author>Daniel Ruoso</author>
<guid isPermaLink="true">http://www.perlfoundation.org/perl6/index.cgi?smop_code_implementation</guid>
<pubDate>Sat, 16 Aug 2008 16:56:52 -0000</pubDate>
</item>

</channel>
</rss>