[27944] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 9308 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 16 18:06:00 2006

Date: Fri, 16 Jun 2006 15:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 16 Jun 2006     Volume: 10 Number: 9308

Today's topics:
    Re: ANNOUNCE: WWW::YouTube <daveandniki@ntlworld.com>
    Re: Binding array to pattern <benmorrow@tiscali.co.uk>
    Re: Binding array to pattern <uri@stemsystems.com>
    Re: Flat file missing <noreply@gunnar.cc>
        Outlook Crapolla: The Fakie Breakie <afrinspray@gmail.com>
    Re: Outlook Crapolla: The Fakie Breakie <rvtol+news@isolution.nl>
    Re: question on processing mysql <"v.niekerk at hccnet.nl">
    Re: reference to object method <uri@stemsystems.com>
    Re: Testing a new password <mark@gangwarily.ca>
    Re: Testing a new password <someone@example.com>
    Re: What is Expressiveness in a Computer Language <find@my.address.elsewhere>
    Re: What is Expressiveness in a Computer Language <dnew@san.rr.com>
    Re: What is Expressiveness in a Computer Language <find@my.address.elsewhere>
    Re: What is Expressiveness in a Computer Language <dnew@san.rr.com>
    Re: What is Expressiveness in a Computer Language <jo@durchholz.org>
    Re: What is Expressiveness in a Computer Language <jo@durchholz.org>
        YAPC::NA is approaching fast! <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 16 Jun 2006 20:38:46 +0200
From: "Dave" <daveandniki@ntlworld.com>
Subject: Re: ANNOUNCE: WWW::YouTube
Message-Id: <4492fac1$0$892$ba4acef3@news.orange.fr>


"Eric R. Meyers" <ermeyers@adelphia.net> wrote in message 
news:HuqdnSp2hPcukA_ZnZ2dnUVZ_sydnZ2d@adelphia.com...
> Gentlemen and Ladies of the Perl/CPAN Community,
>
> I sincerely need your help, right now, ASAP.
>
> I was a registered developer with YouTube, and they've BLACKLISTED me for
> flagging videos in the areas of "hot babes," "foot fetish" and "bondage
> tickling."
>
> If you would be so very sensitive and thoughtful as to experiment with my
> YouTube Development Interface (YTDI), called WWW::YouTube, I would greatly
> appreciate your immediate efforts. And I'll be readily available to help
> get you started hitting YouTube with a reality check of a world-wide
> collective effort against Pornography and Obscenity in the public domain.
>
> I developed the WWW::YouTube interface to protect children, and YouTube
> seems to have a problem with that simple concept, so I'm looking for 
> anyone
> who'll help me put some political pressure upon YouTube, to protect
> children, teenagers and the General Public.
>
> Please email me at ermeyers@adelphia.net if you have any questions or
> problems setting thing up. Immediate portability fixes will be made
> available to you, ASAP.
>
> Thanks,
>
> Eric

Hi Eric,

As sincere as your efforts seem to be, there are a couple of problems with 
this posting:

1) It is off topic for this group, which is a technical discussion group 
(see the posting guidelines)

2) There is insufficient context in your posting to know what you are 
talking about - indeed I'm still in the dark after looking at the 
description of your module on cpan. I don't think YouTube is as widely known 
as you may believe. (I had never heard of it and am assuming it is some kind 
of video download site from what you are saying.)




------------------------------

Date: Fri, 16 Jun 2006 19:53:23 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Binding array to pattern
Message-Id: <3abbm3-11e.ln1@osiris.mauzo.dyndns.org>


Quoth "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>:
> In <x77j3izamr.fsf@mail.sysarch.com>, on 06/15/2006
>    at 11:44 AM, Uri Guttman <uri@stemsystems.com> said:
> 
> >that is wrong.
> 
> Whoops! I edited the text from the article instead of doing a
> cut-and-paste directly from my code. Make that
> 
>   my $email_contact = $email_info->{$_} ;
>   push @Contacts, @{$email_contact};

>   my $scalarContacts="@{$email_contact}";
>   push @abuseContacts, @{$email_contact}
>     if (/abuse/ or $scalarContacts =~ /abuse/);

These three lines are equivalent to

    push @abuseContacts, @{$email_contact}
        if grep /abuse/, $_, @{$email_contact};

except that doesn't waste time (both for the machine and the human
reading the code) stringifying the array; and there aren't problems with 

    $email_contact = ['fooab', 'use this'];

(though I suspect this isn't an issue in your case).

You do realise this will push *all* of @{$email_contact} onto
@abuseContact, if *any* of them match? From your description below I
can't quite see how this could be what you want.

> I'm extracting e-mail contacts from whois data. In some cases there
> are multiple contacts for the same role. The abuse contacts might have
> the word "abuse" in the addresses or might have it only in the tags.
> If there are abuse contacts then I want to put them in a message;

By 'abuse contacts' you mean 'email addresses matching /abuse/', right?
[Side issue: are you sure you mean /abuse/ and not /^abuse\@/ ?]

> otherwise want to put all of the e-mail in a different message.

 ...so you can read the tags and find the correct addr by hand? Do you
want the whole whois reply, or just all the email addesses in the reply?

In any case, I'd do something like (untested)

    my @abuse_addrs;
    my @misc_addrs;
    my @domains = ...;

    for (@domains) {
        my $whois  = get_whois_data($_);
        my @emails = extract_email_addrs($whois);

        my @ae = grep /abuse/, @emails;
        if (@ae) {
            push @abuse_addrs, @ae;
        }
        else {
            push @misc_addrs, $whois; # or @emails
        }
    }

Or have I misunderstood you?

> >that makes no sense as there is no order in hashes so first can't
> >exist. you want any() from quantum::superpositions or one of the
> >perl6 modules.
> 
> When will Perl6 be ready for prime time?

Err... not for a while :). Perl5 will be the supported and developed
version of Perl for the forseeable future. Some features of Perl6 are
available for Perl5 in the modules in the Perl6::* namespace; any() is
in Perl6::Junction (or, as Uri said, in Quantum::Superpositions, though
that's likely much slower); also in List::MoreUtils, which is probably
what I'd use if I needed it.

Ben

-- 
For far more marvellous is the truth than any artists of the past imagined!
Why do the poets of the present not speak of it? What men are poets who can
speak of Jupiter if he were like a man, but if he is an immense spinning sphere
of methane and ammonia must be silent? [Feynmann]       benmorrow@tiscali.co.uk


------------------------------

Date: Fri, 16 Jun 2006 15:12:41 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Binding array to pattern
Message-Id: <x7ac8cud7a.fsf@mail.sysarch.com>

>>>>> "S(J)M" == Shmuel (Seymour J ) Metz <spamtrap@library.lspace.org.invalid> writes:

  S(J)M> Whoops! I edited the text from the article instead of doing a
  S(J)M> cut-and-paste directly from my code. Make that

always cut/paste real code here. otherwise you waste your and our time.

  >> that is very unclear to me.

  S(J)M> I'm extracting e-mail contacts from whois data. In some cases there
  S(J)M> are multiple contacts for the same role. The abuse contacts might have
  S(J)M> the word "abuse" in the addresses or might have it only in the tags.
  S(J)M> If there are abuse contacts then I want to put them in a message;
  S(J)M> otherwise want to put all of the e-mail in a different message. That's
  S(J)M> part of a larger program that deobfuscates a spa e-mail and attempts
  S(J)M> to locate information on the sender and the drop boxes for use in a
  S(J)M> complaint.

again, you are somewhat unclear. 'put them in a message' means what? in
the to: fields of email? in the body? 'all of the email' means what? all
addresses in the whole whois record? only those with abuse in the
address? only those emails in a section which mentions abuse? specifying
clean problem requirements is the key to any solution.

i smell an XY problem here. it is always best to explain the original
problem than to ask how to solve it in the way you picked. just going
back to the whois data may make this whole thing much easier. what is
the format of the whois records?

  >> that makes no sense as there is no order in hashes so first can't
  >> exist. you want any() from quantum::superpositions or one of the
  >> perl6 modules.

  S(J)M> When will Perl6 be ready for prime time?

there are perl6 modules on cpan which are written in perl5. look at the
Perl6:: namespace.

but i will wait until i see the whois stuff. solving your problem from
that level looks like it will be much easier. 

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Fri, 16 Jun 2006 21:22:25 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Flat file missing
Message-Id: <4fgejqF1iodiiU1@individual.net>

asg wrote:
> i use the code below for a page counter. when it gets to around a 900
> count, it resets to 1. any ideas as to why?

Others have pointed you to better ways to do what you want. I for one am 
a happy user of DBM files for page counters. See this script for an 
example: http://www.gunnar.cc/programs/counter.pl.txt

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: 16 Jun 2006 11:55:00 -0700
From: "afrinspray" <afrinspray@gmail.com>
Subject: Outlook Crapolla: The Fakie Breakie
Message-Id: <1150484100.572112.104190@c74g2000cwc.googlegroups.com>

I'm writing a MIME::Tools email parsing engine.  This utility rocks by
the way... the whole package makes mime processing very easy.

My problem however is with Outlook emails and they're horrible styling.
 While normal people will use the <br> tag for line breaks, outlook
likes to do stuff like this:

<DIV dir=ltr align=left><FONT size=2><SPAN
class=3D671020819-14062006></SPAN></FONT>&nbsp;</DIV>

They like to use these weird css classes as well, like
3D671020819-14062006 (which isn't defined anywhere in the document) and
MsoNormal.  Also, they like to use random garbage pseudo-breaks here
and there that don't show up in outlook, but show up in every other
html parser I've seen... so I'm using the HTML::Tree class to remove
empty breaks. Uggg... it's just a total mess.

Is there a reliable perl module for converting Outlook garbage into
real HTML? 

Thanks,
Mike



------------------------------

Date: Fri, 16 Jun 2006 21:30:22 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Outlook Crapolla: The Fakie Breakie
Message-Id: <e6v83o.1as.1@news.isolution.nl>

afrinspray schreef:

> <DIV dir=ltr align=left><FONT size=2><SPAN
> class=3D671020819-14062006></SPAN></FONT>&nbsp;</DIV>

If the whole message is in $_, then you could do

  s~ < (SPAN) (?:\s[^>]*)? > \s*            < / \1 > ~~xg ;
  s~ < (FONT) (?:\s[^>]*)? > \s*            < / \1 > ~~xg ;
  s~ < (DIV)  (?:\s[^>]*)? > \s* &nbsp; \s* < / \1 > ~~xg ;


Test:

echo '
a<DIV dir=ltr align=left><FONT size=2><SPAN
class=3D671020819-14062006></SPAN></FONT>&nbsp;</DIV>b
' | perl -we '

  undef $/ ;
  $_ = <> ;

  s~< (SPAN) (?:\s[^>]*)? > \s*            < / \1 > ~~xg ;
  s~< (FONT) (?:\s[^>]*)? > \s*            < / \1 > ~~xg ;
  s~< (DIV)  (?:\s[^>]*)? > \s* &nbsp; \s* < / \1 > ~<br>~xg ;
  print
'

Prints: a<br>b

-- 
Affijn, Ruud

"Gewoon is een tijger."




------------------------------

Date: Fri, 16 Jun 2006 21:15:12 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: Re: question on processing mysql
Message-Id: <4493033f$0$26761$e4fe514c@dreader13.news.xs4all.nl>

Ok, found the problems....had $ where I should use @ and used the wrong 
recordnumber.
Other question: which function should I use to print to a printer? 
FileHandle or IO:: ?


------------------------------

Date: Fri, 16 Jun 2006 15:13:18 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: reference to object method
Message-Id: <x764j0ud69.fsf@mail.sysarch.com>

>>>>> "JB" == John Bokma <john@castleamber.com> writes:

  JB> Uri Guttman <uri@stemsystems.com> wrote:
  >> and your mother is fixed and also ugly too! :)

  JB> Ah, is it time for the "Your mother ..." jokes?

yes, yapc::na is approaching fast!

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Fri, 16 Jun 2006 16:16:55 -0400
From: Mark Drummond <mark@gangwarily.ca>
Subject: Re: Testing a new password
Message-Id: <2O2dnT58Z7QqjA7ZnZ2dnUVZ_oKdnZ2d@magma.ca>

John W. Krahn wrote:
> 
> $ perl -le'
> sub newpass {
>     my $passlen = $_[ 0 ] || 8;
>     my @chars = ( q[a] .. q[z], q[A] .. q[Z], 0 .. 9 );
>     my $pass;
>     $pass = join q[], map $chars[ rand @chars ], 1 .. $passlen
>         until $pass =~ y/a-z// && $pass =~ y/A-Z// && $pass =~ y/0-9//;
>     $pass;
>     }
> print newpass 10 for 1 .. 10;
> '

This seems to be generating proper passwords but I do get a warning:

sub newpassword {
	my $password;
	my $password_length = $_[0] || 10;
	my @chars = ( q[a] .. q[z], q[A] .. q[Z], 0 .. 9 );

	$password = join q[], map $chars[rand @chars], 1 .. $password_length
		until $password =~ y/a-z// and $password =~ y/A-Z// and $password =~ 
y/0-9//;
	return $password;
}

Use of uninitialized value in transliteration (tr///) at file2ldap.pl 
line 111
, <FILE_USERS> line 344.

It seems to work fine, but I don't like to see warnings if I can avoid them.

Mark.


------------------------------

Date: Fri, 16 Jun 2006 21:48:38 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Testing a new password
Message-Id: <WGFkg.44108$771.18514@edtnps89>

Mark Drummond wrote:
> John W. Krahn wrote:
>>
>> $ perl -le'
>> sub newpass {
>>     my $passlen = $_[ 0 ] || 8;
>>     my @chars = ( q[a] .. q[z], q[A] .. q[Z], 0 .. 9 );
>>     my $pass;
>>     $pass = join q[], map $chars[ rand @chars ], 1 .. $passlen
>>         until $pass =~ y/a-z// && $pass =~ y/A-Z// && $pass =~ y/0-9//;
>>     $pass;
>>     }
>> print newpass 10 for 1 .. 10;
>> '
> 
> This seems to be generating proper passwords but I do get a warning:
> 
> sub newpassword {
>     my $password;
>     my $password_length = $_[0] || 10;
>     my @chars = ( q[a] .. q[z], q[A] .. q[Z], 0 .. 9 );
> 
>     $password = join q[], map $chars[rand @chars], 1 .. $password_length
>         until $password =~ y/a-z// and $password =~ y/A-Z// and
> $password =~ y/0-9//;
>     return $password;
> }
> 
> Use of uninitialized value in transliteration (tr///) at file2ldap.pl
> line 111
> , <FILE_USERS> line 344.
> 
> It seems to work fine, but I don't like to see warnings if I can avoid
> them.

Change:

     my $password;

To:

     my $password = '';

And you won't get that warning message.



John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Fri, 16 Jun 2006 13:10:34 -0500
From: Matthias Blume <find@my.address.elsewhere>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <m1bqsthsyt.fsf@hana.uchicago.edu>

Darren New <dnew@san.rr.com> writes:

> Joachim Durchholz wrote:
>> Give a heterogenous list that would to too awkward to live in a
>> statically-typed language.
>
> Printf()?

Very good statically typed versions of printf exist.  See, e.g.,
Danvy's unparsing combinators.


------------------------------

Date: Fri, 16 Jun 2006 19:06:46 GMT
From: Darren New <dnew@san.rr.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <ajDkg.14294$Z67.2650@tornado.socal.rr.com>

Matthias Blume wrote:
> Very good statically typed versions of printf exist.  See, e.g.,
> Danvy's unparsing combinators.

That seems to ignore the fact that the pattern is a string, which means 
that printf's first argument in Danvy's mechanism has to be a literal. 
You can't read the printf format from a configuration file (for example) 
to support separate languages. It doesn't look like the version of 
printf that can print its arguments in an order different from the order 
provided in the argument list is supported either; something like "%3$d" 
or some such.

Second, what's the type of the argument that printf, sprintf, fprintf, 
kprintf, etc all pass to the subroutine that actually does the 
formatting? (Called vprintf, I think?)

-- 
   Darren New / San Diego, CA, USA (PST)
     My Bath Fu is strong, as I have
     studied under the Showerin' Monks.


------------------------------

Date: Fri, 16 Jun 2006 15:45:26 -0500
From: Matthias Blume <find@my.address.elsewhere>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <m17j3gj0d5.fsf@hana.uchicago.edu>

Darren New <dnew@san.rr.com> writes:

> Matthias Blume wrote:
>> Very good statically typed versions of printf exist.  See, e.g.,
>> Danvy's unparsing combinators.
>
> That seems to ignore the fact that the pattern is a string, which
> means that printf's first argument in Danvy's mechanism has to be a
> literal.

In Danvy's solution, the format argument is not a string.

> You can't read the printf format from a configuration file
> (for example) to support separate languages.

You don't need to do that if you want to support separate languages.
Moreover, reading the format string from external input is a good way
of opening your program to security attacks, since ill-formed data on
external media are then able to crash you program.

> It doesn't look like the
> version of printf that can print its arguments in an order different
> from the order provided in the argument list is supported either;
> something like "%3$d" or some such.

I am not familiar with the version of printf you are refering to, but
I am sure one could adapt Danvy's solution to support such a thing.

> Second, what's the type of the argument that printf, sprintf, fprintf,
> kprintf, etc all pass to the subroutine that actually does the
> formatting? (Called vprintf, I think?)

Obviously, a Danvy-style solution (see, e.g., the one in SML/NJ's
library) is not necessarily structured that way.  I don't see the
problem with typing, though.

Matthias


------------------------------

Date: Fri, 16 Jun 2006 21:10:50 GMT
From: Darren New <dnew@san.rr.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <u7Fkg.15096$uy3.2589@tornado.socal.rr.com>

Matthias Blume wrote:
> In Danvy's solution, the format argument is not a string.

That's what I said, yes.

>>You can't read the printf format from a configuration file
>>(for example) to support separate languages.

> You don't need to do that if you want to support separate languages.

That's kind of irrelevant to the discussion. We're talking about 
collections of dynamically-typed objects, not the best mechanisms for 
supporting I18N.

> Moreover, reading the format string from external input is a good way
> of opening your program to security attacks, since ill-formed data on
> external media are then able to crash you program.

Still irrelevant to the point.

> I am sure one could adapt Danvy's solution to support such a thing.

I'm not. It's consuming arguments as it goes, from what I understood of 
the paper. It's translating, essentially, into a series of function 
calls in argument order.

> Obviously, a Danvy-style solution (see, e.g., the one in SML/NJ's
> library) is not necessarily structured that way.  I don't see the
> problem with typing, though.

You asked for an example of a heterogenous list that would be awkward in 
a statically strongly-typed language. The arguments to printf() count, 
methinks. What would the second argument to apply be if the first 
argument is printf (since I'm reading this in the LISP group)?

-- 
   Darren New / San Diego, CA, USA (PST)
     My Bath Fu is strong, as I have
     studied under the Showerin' Monks.


------------------------------

Date: Fri, 16 Jun 2006 23:57:10 +0200
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e6v9fa$pgc$1@online.de>

Sacha schrieb:
> 
> Many lists are heterogenous, even in statically typed languages.
> For instance lisp code are lists, with several kinds of atoms and 
> sub-lists..

Lisp isn't exactly a statically-typed language :-)

> A car dealer will sell cars, trucks and equipment..
> In a statically typed language you would need to type the list on a common 
> ancestor...

Where's the problem with that?

BTW the OO way isn't the only way to set up a list from heterogenous data.
In statically-typed FPL land, lists require homogenous data types all 
right, but the list elements aren't restricted to data - they can be 
functions as well.
Now the other specialty of FPLs is that you can construct functions at 
run-time - you take a function, fill some of its parameters and leave 
others open - the result is another function. And since you'll iterate 
over the list and will do homogenous processing over it, you construct 
the function so that it will do all the processing that you'll later need.

The advantage of the FPL way over the OO way is that you can use ad-hoc 
functions. You don't need precognition to know which kinds of data 
should be lumped under a common supertype - you simply write and/or 
construct functions of a common type that will go into the list.

> What would then be the point of statical typing , as you stilll need to type 
> check each element in order to process that list ?

Both OO and FPL construction allow static type checks.

 > Sure you can do this in a
> statically-typed
> language, you just need to make sure some relevant ancestor exists. In my 
> experience
> you'll end up with the base object-class more often than not, and that's 
> what i call dynamic typing.

Not quite - the common supertype is more often than not actually useful.

However, getting the type hierarchy right requires a *lot* of 
experimentation and fine-tuning. You can easily spend a year or more 
(sometimes *much* more) with that (been there, done that). Even worse, 
once the better hierarchy is available, you typically have to adapt all 
the client code that uses it (been there, done that, too).

That's the problems in OO land. FPL land doesn't have these problems - 
if the list type is just a function mapping two integers to another 
integer, reworking the data types that went into the functions of the 
list don't require those global changes.

>> Give a case of calling nonexistent functions that's useful.
> 
> I might want to test some other parts of my program before writing this 
> function.

That's unrelated to dynamic typing. All that's needed is an environment 
that throws an exception once such an undefined function is called, 
instead of aborting the compilation.

I'll readily admit that very few static languages offer such an 
environment. (Though, actually, C interpreters do exist.)

> Or maybe will my program compile that function depending on user input.

Hmm... do I really want this kind of power at the user's hand in the age 
of malware?

> As long as i get a warning for calling a non-existing function, everything 
> is fine.

That depends.
For software that's written to run once (or very few times), and where 
somebody who's able to correct problems is always nearby, that's a 
perfectly viable strategy.
For safety-critical software where problems must be handled within 
seconds (or an even shorter period of time), you want to statically 
ensure as many properties as you can. You'll take not just static 
typing, you also want to ascertain value ranges and dozens of other 
properties. (In Spark, an Ada subset, this is indeed done.)

Between those extremes, there's a broad spectrum.


------------------------------

Date: Fri, 16 Jun 2006 23:59:07 +0200
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e6v9iv$pgc$2@online.de>

Raffael Cavallaro schrieb:
> There is a very large class of software where user inputs are 
> unpredictable and/or where input data comes from an untrusted source. In 
> these cases run-time checks are going to be needed anyway so the 
> advantages of static type checking are greatly reduced - you end up 
> doing run-time checks anyway, precisely the thing you were trying to 
> avoid by doing static analysis.

There's still a large class of errors that *can* be excluded via type 
checking.

> Ideally one wants a language with switchable typing - static where 
> possible and necessary, dynamic elsewhere.

That has been my position for a long time now.

 > To a certain extent this is
> what common lisp does but it requires programmer declarations. Some 
> implementations try to move beyond this by doing type inference and 
> alerting the programmer to potential static guarantees that the 
> programmer could make that would allow the compiler to do a better job.

I think it's easier to start with a good (!) statically-typed language 
and relax the checking, than to start with a dynamically-typed one and 
add static checks.
With the right restrictions, a language can make all kinds of strong 
guarantees, and it can make it easy to construct software where static 
guarantees abound. If the mechanisms are cleverly chosen, they interfere 
just minimally with the programming process. (A classical example it 
Hindley-Milner type inference systems. Typical reports from languages 
with HM systems say that you can have it verify thousand-line programs 
without a single type annotation in the code. That's actually far better 
than you'd need - you'd *want* to document the types at least on the 
major internal interfaces after all *grin*.)
With a dynamically-typed language, programming style tends to evolve in 
directions that make it harder to give static guarantees.

> It seems to 
> me that if we set aside that class of software where safety is paramount 
> - mostly embedded software such as aircraft and medical devices - we are 
> left mostly with efficiency concerns.

Nope. Efficiency has taken a back seat. Software is getting slower 
(barely offset by increasing machine speed), and newer languages even 
don't statically typecheck everything (C++, Java). (Note that the 
impossibility to statically typecheck everything in OO languages doesn't 
mean that it's impossible to do rigorous static checking in general. 
FPLs have been quite rigorous about static checks; the only cases when 
an FPL needs to dynamically typecheck its data structures is after 
unmarshalling one from an untyped data source such as a network stream, 
a file, or an IPC interface.)

The prime factor nowadays seems to be maintainability.

And the difference here is this:
With dynamic typing, I have to rely on the discipline of the programmers 
to document interfaces.
With static typing, the compiler will infer (and possibly document) at 
least part of their semantics (namely the types).

> So static typing should be invoked for that small portion of a program 
> where efficiency is really needed and that dynamic typing should be the 
> default elswhere. This is how common lisp works - dynamic typing by 
> default with static guarantees available where one needs them.

Actually static typing seems to become more powerful at finding errors 
as the program size increases.
(Yes, that's a maintainability argument. Efficiency isn't *that* 
important; since maintenance is usually the most important single 
factor, squelching bugs even before testing is definitely helpful.)

Regards,
Jo


------------------------------

Date: Fri, 16 Jun 2006 15:21:43 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: YAPC::NA is approaching fast!
Message-Id: <x71wtoucs8.fsf@mail.sysarch.com>


if you haven't yet registered for yapc::na yet, you still have
time. yapc is the most incredible conference value (only $100 for the
conference) going and the only pure perl conference out there. you are
guaranteed to have fun and learn more about perl as well. you can rub
and bend elbow with many of the perl royalty as well and meet and hang
out with perl hackers of all skill levels from all over the world.

go here to register:

	http://yapcchicago.org/zencart/

the main home page is at:

	http://yapcchicago.org

the schedule of talks is here: 

	http://yapcchicago.org/the-schedule/

you can take day long classes with perl masters (clpm regulars brian d
foy and randal schwartz and the always amazing damian conway) for only
$200 (usually about $500!)

	http://www.yapcchicago.org/zencart/index.php?main_page=index&cPath=3&zenid=6fc2d238d5d9fb21aff2c9439d17b533

you can read about more of the fun events that are scheduled and such on
the yapc wiki:

	http://yapcchicago.org/wiki/index.cgi?

hope to see you there!

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 9308
***************************************


home help back first fref pref prev next nref lref last post