--- 
author: 
  email: ''
  keyid: 0
  name: Anonymous Coward
categories: []

date: 2009-05-03T23:11:16Z
guid: 6e9a36be-2193-4276-b308-e4fc8b85fc66
modified: 2009-05-03T23:11:16Z
raw: "Thanks, Florian.\r\n- Dotan\r\n\r\n\n"
signed: 0
summary: "    Thanks, Florian. - Dotan\n"
tags: []

text: "    Thanks, Florian. - Dotan\n"
title: "Re: Re: Re: Implementing Typed Lexical Variables"
type: pod
uri: http://pd.perldition.org/comments/97a76a6d-4019-4554-9993-2de23bde7e39/a05d8b69-4fcd-4333-bc29-f62d30466e07/2d800d8a-24e9-4dad-bf49-b2847bc3dad6/6e9a36be-2193-4276-b308-e4fc8b85fc66
xhtml: "<div class=\"pod\">\n<p>Thanks, Florian.\r\n- Dotan\r</p>\n\n\n\n\n\n</div>"
--- 
author: 
  email: rafl@fsfe.org
  keyid: 742f2a428e635a5e
  name: Florian Ragwitz
categories: []

date: 2009-05-02T23:44:24Z
guid: 2d800d8a-24e9-4dad-bf49-b2847bc3dad6
modified: 2009-05-02T23:46:12Z
raw: "-----BEGIN PGP SIGNED MESSAGE-----\r\nHash: SHA1\r\n\r\n=pod\r\n\r\nThat's what the empty prototype in the anonymous sub that get's installed in the blog posts as well as L<MooseX::Lexical::Types on CPAN|http://search.cpan.org/perldoc?MooseX::Lexical::Types> is for:\r\n\r\n  lang:Perl\r\n  $meta->add_package_symbol('&'.$type_name => sub () { $decorator });\r\n\r\nIt allows you to tell perl that your function doesn't take any arguments and is constant. With that, it can be inlined, which means it will be called during compile time and the result will be put in the place where the function call was:\r\n\r\n  $ perl -le'{ package bob; } sub foo () { q{bob} }; my foo $bax = q{bax}; print $bax;'\r\n  bax\r\n\r\nNote that the package, which name is returned by C<foo>, still needs to exist.\r\n\r\n=cut\r\n-----BEGIN PGP SIGNATURE-----\r\nVersion: GnuPG v1.4.9 (GNU/Linux)\r\nComment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.5)\r\n\r\niEYEARECAAYFAkn8210ACgkQdC8qQo5jWl61/ACeLr0cu+04Xc9Q89p7i2BvgHbw\r\nACcAniEsG0We5qOmEQWxbSo4qaxzqD50\r\n=uTaG\r\n-----END PGP SIGNATURE-----\r\n\n"
signed: 1
summary: " That's what the empty prototype in the anonymous sub …"
tags: []

text: "    That's what the empty prototype in the anonymous sub that get's\n    installed in the blog posts as well as MooseX::Lexical::Types on\n    CPAN is for:\n\n      lang:Perl $meta->add_package_symbol('&'.$type_name => sub () {\n      $decorator });\n\n    It allows you to tell perl that your function doesn't take any argu-\n    ments and is constant. With that, it can be inlined, which means it\n    will be called during compile time and the result will be put in the\n    place where the function call was:\n\n      $ perl -le'{ package bob; } sub foo () { q{bob} }; my foo $bax =\n      q{bax}; print $bax;' bax\n\n    Note that the package, which name is returned by foo, still\n    needs to exist.\n"
title: "Re: Re: Implementing Typed Lexical Variables"
type: pod
uri: http://perldition.org/comments/97a76a6d-4019-4554-9993-2de23bde7e39/a05d8b69-4fcd-4333-bc29-f62d30466e07/2d800d8a-24e9-4dad-bf49-b2847bc3dad6
xhtml: "<div class=\"pod\">\n<p>That's what the empty prototype in the anonymous sub that get's installed in the blog posts as well as <a href=\"http://search.cpan.org/perldoc?MooseX::Lexical::Types\">MooseX::Lexical::Types on CPAN</a> is for:\r</p>\n<pre>$meta-&gt;add_package_symbol('&amp;'.$type_name =&gt; sub () { $decorator });\r\n</pre>\n<p>It allows you to tell perl that your function doesn't take any arguments and is constant. With that, it can be inlined, which means it will be called during compile time and the result will be put in the place where the function call was:\r</p>\n<pre>$ perl -le'{ package bob; } sub foo () { q{bob} }; my foo $bax = q{bax}; print $bax;'\r\nbax\r\n</pre>\n<p>Note that the package, which name is returned by <code>foo</code>, still needs to exist.\r</p>\n\n\n</div>"
--- 
author: 
  email: ''
  keyid: 0
  name: Anonymous Coward
categories: []

date: 2009-05-02T18:41:24Z
guid: a05d8b69-4fcd-4333-bc29-f62d30466e07
modified: 2009-05-02T18:41:24Z
raw: "This is dazzling, but what's an inlineable function and how do I get one? I can avoid the 'No such class' error by declaring a package, but not by declaring a sub.\r\n\r\n   perl -le 'my foo $bax = q{bax}; print $bax;'\r\n   No such class foo at -e line 1, near \"my foo\"\r\n   Execution of -e aborted due to compilation errors.\r\n\r\n\r\n   perl -le 'package foo; package main; my foo $bax = q{bax}; print $bax;'\r\n   bax\r\n\r\n  perl -le 'sub foo { q{bob} };  my foo $bax = q{bax}; print $bax;'\r\nNo such class foo at -e line 1, near \";  my foo\"\r\n\r\n\n"
signed: 0
summary: " This is dazzling, but what's an inlineable function and …"
tags: []

text: "    This is dazzling, but what's an inlineable function and how do I get\n    one? I can avoid the 'No such class' error by declaring a package,\n    but not by declaring a sub.\n\n       perl -le 'my foo $bax = q{bax}; print $bax;' No such class foo at\n       -e line 1, near \"my foo\" Execution of -e aborted due to compila-\n       tion errors.\n\n\n       perl -le 'package foo; package main; my foo $bax = q{bax}; print\n       $bax;' bax\n\n      perl -le 'sub foo { q{bob} }; my foo $bax = q{bax}; print $bax;'\n      No such class foo at -e line 1, near \"; my foo\"\n"
title: "Re: Implementing Typed Lexical Variables"
type: pod
uri: http://perldition.org/comments/97a76a6d-4019-4554-9993-2de23bde7e39/a05d8b69-4fcd-4333-bc29-f62d30466e07
xhtml: "<div class=\"pod\">\n<p>This is dazzling, but what's an inlineable function and how do I get one? I can avoid the 'No such class' error by declaring a package, but not by declaring a sub.\r</p>\n<pre>perl -le 'my foo $bax = q{bax}; print $bax;'\r\nNo such class foo at -e line 1, near &quot;my foo&quot;\r\nExecution of -e aborted due to compilation errors.\r\n\n\r\n\nperl -le 'package foo; package main; my foo $bax = q{bax}; print $bax;'\r\nbax\r\n\n  perl -le 'sub foo { q{bob} };  my foo $bax = q{bax}; print $bax;'\r\nNo such class foo at -e line 1, near &quot;;  my foo&quot;\r\n\n\n</pre>\n\n\n</div>"
