Revelation's Journal Revelation's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:43:53+00:00 pudge Technology hourly 1 1970-01-01T00:00+00:00 Revelation's Journal Slick Rick: Free! <p>Since I haven't posted in a while, I figured I post some news for my fellow use.perl-ers. Rap artist Slick Rick is free, once again!</p><p>A lot of people won't remember or know his old school story telling, some may remember the hit "la di da di" (we like to party), but Ricky D remains a living legend in my book. I can't wait for a concert in the tri-state area; I'll definately be there.</p><p>Anybody want to meet me at a future Slick Rick concert?<nobr> <wbr></nobr>:)</p> Revelation 2003-11-23T21:38:12+00:00 others Beware Of The Sigil: <p> Some more thought about the development of Perl 6- in relation to Perl 5. I consider myself an avid Perl user, who has become better and better at the language as time has gone on. I consider the sigil in Perl 5 to be one of the nicest and most natural constructs, because it gives me an immediate idea of what type of data I&#226;&#8364;&#8482;m dealing with. However, as Perl 6 continues to steamroll its way along, I&#226;&#8364;&#8482;ve become to fear what&#226;&#8364;&#8482;s most natural to me- the sigil! That precious $, @, and % is lashing out at me, and why? Why is because I&#226;&#8364;&#8482;ve accrued a lot of knowledge about clean OO programming with ruby (Perl&#226;&#8364;&#8482;s OO system is a smokes and mirrors kludge that does its job admirably) and I love the elegance of its constructs. It has always made sense to me to hierarchicallize my data- in auction scripts or other scripts I&#226;&#8364;&#8482;ve freelanced for it&#226;&#8364;&#8482;s always made things so much simpler to find- and as such I love doing the same even with datatypes. </p><p> Perl&#226;&#8364;&#8482;s evolution is with me: Perl 6 is doing essentially this- hierarchicalizing datatypes. So much so that, from what I understand from Apoc, and Exegis, I believe sigils will not really mean that much (they'll be the standard definitions, which will be a lot less loosely enforced). Furthermore, there will now be opaque objects, which are basically what I want. If they're implemented as I wish (we'll see- they hopefully will be!), you can consider this a justification of them- otherwise, you can consider this a personal warning. However, it continues with the basic <a href="&amp;%23226;&amp;%238364;">three datatypes</a> that it has always had. Coming from a Perl background this makes sense, arrays, hashes, and scalars (which encompass closures, references, etc.) are all I&#226;&#8364;&#8482;ve ever needed and used. Unfortunately, coming from a linguistic background, this pisses me off: I expected to be able to subclass &#226;&#8364;&#339;Array&#226;&#8364;, and make my own datatypes, without using the sometimes-wonderful ruby construct obj.instance_eval(). I wanted my own defined datatype to be no different from the basic three datatypes- it would be nice if my own &#226;&#8364;&#339;Pseudo-array&#226;&#8364; class, for instance, would have the same basic look and implementation as the array class- although it wouldn&#226;&#8364;&#8482;t be adopted by so many programmers (I think), it&#226;&#8364;&#8482;d be possible for not a massive revision to take place, if it was somehow adopted as a basic datatype, or an important datatype. </p><p> This would be, to me, the ultimate proof that Perl 6 was the community&#226;&#8364;&#8482;s rewrite instead of Larry&#226;&#8364;&#8482;s. The community would be able to contribute to what was considered even a basic datatype- such that a basic array could even be modified, if the community thought it should be different. This is the type of revolutionary thought that made perl the asset to the programming community it initially was. Yes&#226;&#8364;&#166; I know that I could probably write code resembling my @item is PseudoArray, but the first thing people are going to think is &#226;&#8364;&#339;that&#226;&#8364;&#8482;s an array&#226;&#8364;- and as such its default behavior would have to resemble an array rather than a hash. What if I wanted to have its default behavior resemble neither? Would I be able to do my item is PseudoArray, and if so will people test to see its superclass or just get incredibly confused as to why the item has a sigil? I&#226;&#8364;&#8482;d prefer my hypothetical pseudo-array class just had a little bit more weight against the titans of Array, Hash, and Scalar. Regardless of whether this suggestion is taken into account, I&#226;&#8364;&#8482;ll use Perl 6- probably more avidly than I&#226;&#8364;&#8482;ve used Perl 5, but sigils just continue to scare me. </p><p> <b>NB:</b> One thing that I&#226;&#8364;&#8482;m really hoping is that strings will act like both an array of letters, and a single string (even stronger implicit conversion, which is what makes Perl such a great language for me- actually this conversion isn&#226;&#8364;&#8482;t all that implicit, since we&#226;&#8364;&#8482;re telling it to return an array- however it&#226;&#8364;&#8482;d be great if it was implicit- so that<nobr> <wbr></nobr>.string.letters would hold $.string (held by scalar, or string) @.string ( held by array or letters ) and %.string (held by some third field- hash?). It&#226;&#8364;&#8482;d be nice to be able to do: <br> <br> <code> foreach $letter (letters $.string) { print char(ord($letter) + 1);} </code> <br> which would translate to: <br> <code> foreach $letter ( (.string.letters) ) { print char(ord($letter) + 1 } </code> <br> <br> and the same would be true of a pseudo-array: <br> <code> foreach $letter(<nobr> <wbr></nobr>.item_which_actually_hold_a_pseudo_array.letters ) { } </code> <br> At least Larry could consider disallowing IO and other things to go by the external label &#226;&#8364;&#732;item&#226;&#8364;&#8482;, so that instead a superobject of some sort could go there instead for those of us who wanted all datatypes to be equal. If the superobject exhisted, arrays, hashes and everything else wouldn't be allowed for that symbol. Or if they were allowed, they wouldn't be decared, only used as references to the superobject's method.</p> Revelation 2003-06-24T02:43:45+00:00 perl6 Method Chaining (Regarding A Recent Perlmonks Discussion) I'd like to discuss why method chaining is bad <b>for widely distributed modules</b> in response to <a href="">this</a> discussion. I've decided to put it in its own node, because I believe that the topic of why NOT to use it could be very important. I hope that if I share my rationale of the use of method chaining and how it hurts large packages, people will reconsider their belief in that technique. To begin with, it'd be nice to define method chaining- my current definition is chaining a series of methods that work off of a single object. It's used most often for attributes to an object, but I guess it could be used to actually call methods. It's major advantage is that it allows for great brevity, and demonstrates the interconnectedness of the attributes, as well as puts them in a single place. <br> <br> All of these are good things, and as <a href="">demerphq</a> <a href="">said</a>, it seems to make sense to write: <br> <br> <code> print Data::Dumper-&gt;new([$foo],[qw(foo)])-&gt;Indent(2)-&gt;Purity(2)-&gt;Dump(); </code> <br> <br> instead of: <br> <br> <code> print do{my $d=Data::Dumper-&gt;new([$foo],[qw(foo)]); $d-&gt;Indent(2); $d-&gt;Purity(2); $d-&gt;Dump()}; </code> <br> <br> however, this is a rather short sighted consideration, when one looks at the cons of method chaining. If our criteria is as said "easy things should be easy, and hard things possible," we must adopt some sort of standard to make maintanance programming (one of those easy things) and extending packages (another one of those easy things) easy. Method chaining betrays the later, and even makes the former rather hard. <br> <br> Consider even the previous example. A perl programmer, who is familiar with Data::Dumper, would automatically assume that you're modifying multiple attributes of the dumper object. However, a maintanance programmer, or basically anybody not familiar with it, would infer that the programmer is changing the purity of the indent, not the greater object. This is because programming standards (think of them as extended but unenforced grammer, the degree of scrictness after <code>use strict;</code>,) would dictate that as we go further from the left, we get more and more specific, that we are modifying the attribute. <br> <br> But who cares about standards? <i>One shouldn't have to contort oneself to fit into some arbitrary coding scheme when there is no reason to.</i> We're basically selecting a design that isn't common. The problem with that is twofold, first that the majority of people would not consult a reference for such a small item of concern and they would further probably assume that the common standard is being used, and second that the very standard used is used for a reason... <br> <br> It's the sad truth that method chaining leads to problems for people who don't read the documentation, but that it also leads to inflexibility and problems for maintanance programmers. The inflexibility is that of being forced to have seperate accessors and mutators, because accessors have to return the data accessed, wheras mutators are now returning the object modified. This can be delt with by just checking if $_[1] is defined and sending $self if it isn't, so I don't see much of a problem with it. However, method chaining at that moment makes even less intuitive sense, because I'm using the same method with completely differant results, one of which is the parent object, and the other of which is an internal part of that object. <br> <br> But I can cope with that. No big deal. The second problem, however, is something I can't deal with. Consider, from perldoc: <br> <br> <code> $object-&gt;fullname('thadeus'); <br> <br> # But my system's gotten more complicated. <br> # so now I'm going to make fullname into an <br> # object of its own. <br> <br> $object-&gt;fullname('Thadeus Barton')-&gt;christian('Thadusky'); <br> $object-&gt;fullname('Frankeus Muss')-&gt;hobbessian('fransko'); </code> <br> <br> You've created the maintanance/extensibility nightmare of all nightmares! Now it's necessary to document what is a chained method and what isn't. You've also made it possible to do: <code>$object-&gt;size('large')-&gt;fullname('Frankeus Muss')-&gt;hobbessian('fransko');</code> <br> <br> It's a sad day for whoever has to work with that code. So we have to make a decision between the two? If there's a good chance we won't need to extend our work, why do so? Although being able to transparently extend objects (change how it's implemented) without changes usage is one of the major reasons people encapsulate data, it can be sacraficed for DWIM. To me, getting rid of that layer for a few silly strokes is futile. Especially when there's a perfectly valid alternative- all of this, because you were to lazy as a programmer to just have a single set method, which would be the only thing needing documentation: <br> <br> <code> print my $d=Data::Dumper-&gt;new([$foo],[qw(foo)])-&gt;set(Indent =&gt; 2, Purity =&gt; 2)-&gt;dump(); # If brevity is all too necessary. <br> <br> my $d=Data::Dumper-&gt;new([$foo],[qw(foo)]); $d-&gt;set(Indent =&gt; 2, Purity =&gt; 2); print $d-&gt;dump(); </code> <br> <br> At least this way you're not tredding on OO dogma. <br> <small> <b> Gyan Kapur <br> </b> </small> Revelation 2003-06-16T05:10:38+00:00 others Ruby And Perl Having taken a brief hiatus from Perl, I've discovered a new comfort with <a href="">Ruby</a>. Most programmers who use Perl <a href="">religiously</a><nobr> <wbr></nobr>:)rather than as a tool are probably pretty comfortable with what Perl has to offer, but for those of you who want to know more about Ruby and Perl here's my examination. <br> <br> <a href="">deprecated</a> got part of it right when he said <cite>a younger, fresher, prettier language</cite>. However, that statement should be qualified: Yukihiro "Matz" Matsumoto has created a programming language that has evolved beyond respectable. He has a created a language that is theoretically cleaner and more pure than its predecessors, including Perl. He has designed a language that makes writing <a href="">consistent, concise, and flexible</a> code easy. Furthermore, flexibility to Matz is extensibility, which comes from the <cite>deep object-oriented nature</cite> of his language. That nature has made Ruby code a joy to work with, and easy to interpret, regardless of who wrote the original code. It has made Ruby code <i> <a href="">transparent</a> </i>. <br> <br> This all attests to the power of Ruby in the appropriate framework. Unfortunately, by creating a language that makes code maintainable, Matz has made 'ruby hacking' extremely ugly, and gotten rid of some neat idioms (that's only a bad thing to those of us who like to code 'cool' programs). Ruby has become almost too systematic or boring for users who aren't using the language to program professionally, and therefore it has hindered its own growth. <br> <br> Although it looks to be rather successful in Japan, Ruby's success in America has been limited to knowledgeable programmers. That would seem like a good thing initially, but it has proved to be hurtful to the language. Ruby has not needed to combat bad programming styles like Perl has (that need for Perl has been expressed by <a href="">one 'Andy Roonie' style critique</a> of Perl), but it has also been unable to gain the mass appeal and audience of and to unknowledgeable programmers possessed by Perl. <br> <br> So a novice go to Perl before Ruby (I was initially attracted by Peril&#8217;s code for that reason compared to even C), and because of the sheer volume of Perl users code gets published at a faster pace. This means that Perl libraries will constantly be ahead of Ruby, and all those programmers that are in love with <a href="">CPAN</a> will never get comparable results with <a href="">RAA</a>. The musings laid are part of the greater implications: <br> <br> <b>The Greater Implications Of Ruby's Successes For Perl:</b> <br> Perl has a wealth of features it can (and will) draw from Ruby in Perl 6. To me, what Perl needs to draw most from Ruby is its organization. If Perl can make organizing programs as easy as Ruby, it will be a much stronger language. However, the language cannot loose its flexibility and hacking nature. When it comes to programming, in the end it's all about popularity, not theory. From what I've read, this is exactly what's going to happen. People who want Perl to be clean will get clean Perl. <br> <br> Perl has already decreed its drawing of syntax from Ruby (I expect OO syntax to be very similar to Ruby's, which has proved exceptional.) However, to me, allowing an array of a certain object, hash of a certain object, and scalar value for a certain object is natural. The same is true for Damian and Larry, which is evidenced by the decision to <a href="">let go of typeglobs</a>. Instead, the symbol table will now be full of $package::'@symbol' or $symbols, depending on whether the item is an array, hash, or scalar, etc. However, I'm skeptical as to how one could accomplish the combination of this new symbol table with the idea of @Array is Array. Doesn't that create objects with immutable types at the most basic level? Isn't that exactly what Ruby's 'an object is an object is an object' mentality tries to prevent? How will the two mesh? I fear the solution could be rather verbose I trust in Larry and Damian to design a system, which blends the two. There decision may be one of implementing objects internally, and making an externally arbitrary difference between arrays and hash in the symbol table. <br> <br> <b>The Greater Implications Of Ruby's Failures For Ruby:</b> <br> For Ruby to grow further, it has to create a repository and resource of code that rivals Perl's. Ruby, as a language, provides tools for development that Perl doesn't have, but Perl has <a href="">CPAN</a>. Therefore Ruby's ease of use is offset many times by Perl's libraries, many of which one has to create on his or her own with Ruby. I'm not sure how possible this is to fix, because my previous outlining of Ruby vs. Perl has attempted to show, that CPAN is a result of Perl as a language, its flexibility and hackability of novice users contributes to a great archive of code as those users progress. However, if Ruby puts a valid initiative into building an archive of Ruby (<a href="">or possible of all languages</a>) that has the features of CPAN, and eminent Ruby programmers come out of the woodwork, Ruby should be able to make a valid repository, one which would make Ruby a much more viable alternative to Perl. Revelation 2003-05-26T06:58:06+00:00 journal