<?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: Abstraction and Subroutines</title>
	<atom:link href="http://curiousprogrammer.wordpress.com/2010/06/28/abstraction-and-subroutines/feed/" rel="self" type="application/rss+xml" />
	<link>http://curiousprogrammer.wordpress.com/2010/06/28/abstraction-and-subroutines/</link>
	<description>Leveraging Perl and Emacs</description>
	<lastBuildDate>Tue, 07 May 2013 11:25:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jared</title>
		<link>http://curiousprogrammer.wordpress.com/2010/06/28/abstraction-and-subroutines/#comment-8142</link>
		<dc:creator><![CDATA[Jared]]></dc:creator>
		<pubDate>Thu, 01 Jul 2010 07:49:31 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1073#comment-8142</guid>
		<description><![CDATA[Hi Chas,

I suspect I read more than I write too.  I think I&#039;ve come across the Hash::Util functions before but for some reason I&#039;ve never used them in production code.  Thanks for pointing them out.

Cheers]]></description>
		<content:encoded><![CDATA[<p>Hi Chas,</p>
<p>I suspect I read more than I write too.  I think I&#8217;ve come across the Hash::Util functions before but for some reason I&#8217;ve never used them in production code.  Thanks for pointing them out.</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chas. Owens</title>
		<link>http://curiousprogrammer.wordpress.com/2010/06/28/abstraction-and-subroutines/#comment-8137</link>
		<dc:creator><![CDATA[Chas. Owens]]></dc:creator>
		<pubDate>Wed, 30 Jun 2010 21:22:42 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1073#comment-8137</guid>
		<description><![CDATA[I don&#039;t know about you, but I tend to access hashes more than I add keys to them.  One way to get this typo protection and avoid paying the cost on every access is to use Hash::Util&#039;s (http://perldoc.perl.org/Hash/Util.html) lock_keys_plus:


#!/usr/bin/perl

use strict;
use warnings;

use Hash::Util qw/unlock_keys lock_keys_plus/;

my %h;
my $i = 0;
for my $k (qw/a b c d e f/) {
	unlock_keys %h;
	lock_keys_plus %h, $k;
	$h{$k} = $i++;
}

print &quot;$h{a}\n&quot;;
print &quot;$h{z}\n&quot;;]]></description>
		<content:encoded><![CDATA[<p>I don&#8217;t know about you, but I tend to access hashes more than I add keys to them.  One way to get this typo protection and avoid paying the cost on every access is to use Hash::Util&#8217;s (<a href="http://perldoc.perl.org/Hash/Util.html" rel="nofollow">http://perldoc.perl.org/Hash/Util.html</a>) lock_keys_plus:</p>
<p>#!/usr/bin/perl</p>
<p>use strict;<br />
use warnings;</p>
<p>use Hash::Util qw/unlock_keys lock_keys_plus/;</p>
<p>my %h;<br />
my $i = 0;<br />
for my $k (qw/a b c d e f/) {<br />
	unlock_keys %h;<br />
	lock_keys_plus %h, $k;<br />
	$h{$k} = $i++;<br />
}</p>
<p>print &#8220;$h{a}\n&#8221;;<br />
print &#8220;$h{z}\n&#8221;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jared</title>
		<link>http://curiousprogrammer.wordpress.com/2010/06/28/abstraction-and-subroutines/#comment-8135</link>
		<dc:creator><![CDATA[Jared]]></dc:creator>
		<pubDate>Wed, 30 Jun 2010 20:16:46 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1073#comment-8135</guid>
		<description><![CDATA[@zloyrusskiy - you have managed to miss my point by some distance.  Well done!

&lt;blockquote&gt;But with a less enlightened language than perl, if you have this problem then as long as you also have subroutines, you can fix it.&lt;/blockquote&gt;

@hdp - you have summarized my intention neatly.  Thanks!]]></description>
		<content:encoded><![CDATA[<p>@zloyrusskiy &#8211; you have managed to miss my point by some distance.  Well done!</p>
<blockquote><p>But with a less enlightened language than perl, if you have this problem then as long as you also have subroutines, you can fix it.</p></blockquote>
<p>@hdp &#8211; you have summarized my intention neatly.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zloyrusskiy</title>
		<link>http://curiousprogrammer.wordpress.com/2010/06/28/abstraction-and-subroutines/#comment-8130</link>
		<dc:creator><![CDATA[zloyrusskiy]]></dc:creator>
		<pubDate>Mon, 28 Jun 2010 19:44:22 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1073#comment-8130</guid>
		<description><![CDATA[Ok, i was a little hasty in writing the answer. You right, autovivfication is nothing to do with in this case.

Not so many hashes or number or e.t.c. needs this functional. I can suggest to use &quot;tied variables&quot; for such tasks.

For example:

&lt;pre&gt;
use 5.012;

package Strict_hash;
use Tie::Hash;
use base qw(Tie::StdHash);

sub FETCH {
	exists $_[0]{$_[1]} or die &quot;KeyNotExists: $_[1]\n&quot;;
	$_[0]{$_[1]};
}

1;

package main;

tie( my %h,&#039;Strict_hash&#039; );

%h = ( a =&gt; 1,c =&gt; 3);

say $h{b};
&lt;/pre&gt;

prints:
KeyNotExists: b

And i want to advise you not to try to find bottlenecks by yourself manually them almost impossible to predict, there is special programs for this (Devel::NYTProf for Perl for example).]]></description>
		<content:encoded><![CDATA[<p>Ok, i was a little hasty in writing the answer. You right, autovivfication is nothing to do with in this case.</p>
<p>Not so many hashes or number or e.t.c. needs this functional. I can suggest to use &#8220;tied variables&#8221; for such tasks.</p>
<p>For example:</p>
<pre>
use 5.012;

package Strict_hash;
use Tie::Hash;
use base qw(Tie::StdHash);

sub FETCH {
	exists $_[0]{$_[1]} or die "KeyNotExists: $_[1]\n";
	$_[0]{$_[1]};
}

1;

package main;

tie( my %h,'Strict_hash' );

%h = ( a =&gt; 1,c =&gt; 3);

say $h{b};
</pre>
<p>prints:<br />
KeyNotExists: b</p>
<p>And i want to advise you not to try to find bottlenecks by yourself manually them almost impossible to predict, there is special programs for this (Devel::NYTProf for Perl for example).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hdp</title>
		<link>http://curiousprogrammer.wordpress.com/2010/06/28/abstraction-and-subroutines/#comment-8129</link>
		<dc:creator><![CDATA[hdp]]></dc:creator>
		<pubDate>Mon, 28 Jun 2010 12:21:31 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1073#comment-8129</guid>
		<description><![CDATA[It is ridiculous to suggest that wanting to avoid autovivification means that Jared isn&#039;t a good Perl programmer.  (It&#039;s also irrelevant, since this post does not actually reference autovivification, which is when an undefined value is silently upgraded to an array or hash reference.)

Perl has a lot of features to make writing quick programs easy.  Those same features are often a pain when you have to look through 50k lines of code and figure out why your data is silently being converted from one thing to another somewhere in the middle.  In that context, finding a way to avoid accidental nonexistent hash key lookups is perfectly reasonable.]]></description>
		<content:encoded><![CDATA[<p>It is ridiculous to suggest that wanting to avoid autovivification means that Jared isn&#8217;t a good Perl programmer.  (It&#8217;s also irrelevant, since this post does not actually reference autovivification, which is when an undefined value is silently upgraded to an array or hash reference.)</p>
<p>Perl has a lot of features to make writing quick programs easy.  Those same features are often a pain when you have to look through 50k lines of code and figure out why your data is silently being converted from one thing to another somewhere in the middle.  In that context, finding a way to avoid accidental nonexistent hash key lookups is perfectly reasonable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zloyrusskiy</title>
		<link>http://curiousprogrammer.wordpress.com/2010/06/28/abstraction-and-subroutines/#comment-8128</link>
		<dc:creator><![CDATA[zloyrusskiy]]></dc:creator>
		<pubDate>Mon, 28 Jun 2010 10:07:39 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1073#comment-8128</guid>
		<description><![CDATA[Autovivification - is a very comfortable thing, workarounds around it says that you doesn&#039;t understand Perl-way programming good and you may read some books like &quot;Intermediate Perl&quot; and &quot;High order Perl&quot;, to understand that way and your programs will be much better without workarounds.

Second example (about numbers) i never used in my life in any language =). I can not even imagine where this might come in handy, so you worry about this.

Your problems with Perl programs is in not so good understanding of the language. Try to understand it principles or write your programs in python if deems more appropriate.

P.S. sorry for my bad English, i&#039;m working on it.]]></description>
		<content:encoded><![CDATA[<p>Autovivification &#8211; is a very comfortable thing, workarounds around it says that you doesn&#8217;t understand Perl-way programming good and you may read some books like &#8220;Intermediate Perl&#8221; and &#8220;High order Perl&#8221;, to understand that way and your programs will be much better without workarounds.</p>
<p>Second example (about numbers) i never used in my life in any language =). I can not even imagine where this might come in handy, so you worry about this.</p>
<p>Your problems with Perl programs is in not so good understanding of the language. Try to understand it principles or write your programs in python if deems more appropriate.</p>
<p>P.S. sorry for my bad English, i&#8217;m working on it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
