develooper Front page | perl.perl6.language | Postings from October 2006

Re: "Don't tell me what I can't do!"

Thread Previous
From:
Craig DeForest
Date:
October 2, 2006 09:47
Subject:
Re: "Don't tell me what I can't do!"
Message ID:
BEC20AAC-17F1-4B88-B293-EFD8329528F0@boulder.swri.edu

On Oct 2, 2006, at 10:26 AM, jerry gay wrote:
> On 10/2/06, Jonathan Lang <dataweaver@gmail.com> wrote:
>> I'm not used to programming styles where a programmer intentionally
>> and explicitly forbids the use of otherwise perfectly legal code.  Is
>> there really a market for this sort of thing?
>>
> use strict;
>


The advantage of "use strict" is that it is purely advisory.  If  
you're about to do something
sleazy and you know it, you can always use the escape hatch of "{no  
strict; ... }".

Any such restrictions that a coder places on future users of his code  
or template should also be
advisory.  One big advantage of Perl 5 is that there is an advisory  
class structure that can
be overridden in cases of extreme need, even when the original coder  
clearly intended that you
never override the interface. (an example is DBI, which wraps its  
objects up inside tied hashes simply to prevent access to the inside  
by less-than-determined coders)

Restrictions are useful for code style control, but mainly as  
markers: "Here be dragons", or whatever.  For the case of someone who  
wants that (Jonathan's words) "any declaration of method 'm' that  
doesn't conform to this signature should be illegal", it should be  
possible for the method coder to override that restriction by taking  
some explicit action in the source.  Otherwise we'll have the  
programming equivalent of evil no-fast-forward previews on DVDs.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About