[27949] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9313 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 19 06:05:51 2006

Date: Mon, 19 Jun 2006 03: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           Mon, 19 Jun 2006     Volume: 10 Number: 9313

Today's topics:
    Re: Activeperl and 3DES encryption - probably simple <tom@tom.com>
    Re: Activeperl and 3DES encryption - probably simple <bart@nijlen.com>
    Re: FAQ 1.15 Where can I get a list of Larry Wall witti krakle@visto.com
    Re: FAQ 1.15 Where can I get a list of Larry Wall witti <uri@stemsystems.com>
    Re: File::Find - passing argument to &wanted <uri@stemsystems.com>
    Re: File::Find - passing argument to &wanted <hobosalesman@gmail.com>
        new CPAN modules on Mon Jun 19 2006 (Randal Schwartz)
        noob asks: differences Activestate 5.8.x vs 5.6.x. pros noob@public.com
        Office / Adobe programming? <nadigv@gmail.com>
    Re: Office / Adobe programming? <benmorrow@tiscali.co.uk>
        Printing hash in table format <pradeep.bg@gmail.com>
    Re: Printing hash in table format <hobosalesman@gmail.com>
    Re: Printing hash in table format <siegel@zrz.tu-berlin.de>
    Re: Printing hash in table format <mol10metal@hotmail.com>
        question on printing to /dev/lp <"v.niekerk at hccnet.nl">
    Re: question on processing mysql <siegel@zrz.tu-berlin.de>
    Re: Tk bug not fixed in CPAN <larry.grant.dc@gmail.com>
    Re: What is Expressiveness in a Computer Language (=?iso-8859-1?q?Torben_=C6gidius_Mogensen?=)
    Re: What is Expressiveness in a Computer Language <robert.thorpe@antenova.com>
    Re: What is Expressiveness in a Computer Language (=?iso-8859-1?q?Torben_=C6gidius_Mogensen?=)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 19 Jun 2006 03:08:49 GMT
From: "thomas" <tom@tom.com>
Subject: Re: Activeperl and 3DES encryption - probably simple
Message-Id: <5zolg.25488$VE1.14152@newssvr14.news.prodigy.com>

Thank you for your response.

I just tried using openssl, however with limited success.
Unfortunately the documentation is very incomplete. Actually I was not even 
able to determine whether the example you sent:

openssl des3 -p -a -iv 0000000000000000 -nosalt -kfile MyKey.key -in %f


was supposed to encrypt or decrypt the file. I have no clue what is the 
expected key file format. I tried binary, hex and base 64 and the key 
openssl displays during execution was always different from expected.

Are you aware of any more complete documentation of this command line 
utility than what can be found on the official website?

Thank you,

Tomasz



"tlviewer" <tlviewerSHRUB@yahooCHENEY.com> wrote in message 
news:Z64lg.2690$MF6.2396@tornado.socal.rr.com...
>
> "thomas" <tom@tom.com> wrote in message
> news:HDrkg.55951$4L1.29666@newssvr11.news.prodigy.com...
>> Hello everybody,
>>
>> I have to admit; I am not a perl programmer but I need to test that file
>> encrypted by my program can be decrypted in unix environment using perl
>> script.
>> As far as I know Activeperl comes with libraries supporting 3DES
> encryption.
>>
>> How would a script encrypting a file look like? It needs to take four
>> parameters: input file, output file, encryption key and initialization
>> vector - last two base 64 encoded.
>>
>
> thomas,
>
> To Bart's comments let me add that in the Perl library (CPAN)
>    3DES => Crypt::DES_EDE3
>    AES =>    Crypt::Rijndael
>
> To prepare for Unix interops, you can tryout the OpenSSH commandline 
> utility
> on Windows.
> Download the latest version here
>    www.openssl.org
>
> a sample cmdline call might look like this
> openssl des3 -p -a -iv 0000000000000000 -nosalt -kfile MyKey.key -in %f
>
> hth,
> tlviewer
>
>
> 




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

Date: 19 Jun 2006 01:26:16 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: Activeperl and 3DES encryption - probably simple
Message-Id: <1150705576.335066.180370@h76g2000cwa.googlegroups.com>

thomas wrote:

> Unfortunately I am not a Perl programmer. I was hoping to find some simple,
> ready to use and complete example.
> I, of course, spent some time searching on google and I found nothing. There
> are many complete examples for .Net and Java but I found none in Perl!

The following should do what you want:

  #!perl
  use strict;
  use warnings;
  use Crypt::CBC;
  use MIME::Base64;

  my $input_file ='<abc> Content,
    and $^+</abc>
     More content
   ***
       end';

  my $b64_enc_key = 'c29tZWtleTU0Njg1';
  my $key = decode_base64($b64_enc_key);

  my $b64_enc_init_vector = 'YXplcnR5dWk=';
  my $init_vector = decode_base64($b64_enc_init_vector);

  my $cipher = Crypt::CBC->new( -key    => $key,
                                -cipher => 'DES_EDE3',
                                -iv     => $init_vector,
                                -header => 'randomiv'
                              );

  my $output_file = $cipher->encrypt($input_file);

  # report
  print "\n--------\nINPUT FILE\n--------\n";
  print $input_file;
  print "\n\n--------\nOUTPUT FILE\n--------\n";
  print $output_file;
  print "\n\n--------\nKEY\n--------\n";
  print $key;
  print "\n\n--------\nBASE64 ENCODED KEY\n--------\n";
  print $b64_enc_key;
  print "\n\n--------\nINIT VECTOR\n--------\n";
  print $init_vector;
  print "\n\n--------\nBASE64 ENCODED INIT VECTOR\n--------\n";
  print $b64_enc_init_vector;

Hope this helps,

-- 
 Bart



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

Date: 18 Jun 2006 19:36:04 -0700
From: krakle@visto.com
Subject: Re: FAQ 1.15 Where can I get a list of Larry Wall witticisms?
Message-Id: <1150684564.898958.72490@h76g2000cwa.googlegroups.com>


PerlFAQ Server wrote:
> 1.15: Where can I get a list of Larry Wall witticisms?
> 

This is a Frequently Asked Question????????????



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

Date: Sun, 18 Jun 2006 23:50:15 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: FAQ 1.15 Where can I get a list of Larry Wall witticisms?
Message-Id: <x7zmg9olc8.fsf@mail.sysarch.com>

>>>>> "k" == krakle  <krakle@visto.com> writes:

  k> PerlFAQ Server wrote:
  >> 1.15: Where can I get a list of Larry Wall witticisms?
  >> 

  k> This is a Frequently Asked Question????????????

much more frequent than people asking for a list of your witticisms. and
larry is worthy of a list as he is actually witty!

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: Sun, 18 Jun 2006 23:48:23 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: File::Find - passing argument to &wanted
Message-Id: <x74pyhpzzs.fsf@mail.sysarch.com>

>>>>> "HS" == Hobo Salesman <hobosalesman@gmail.com> writes:

  HS> Juha Laiho wrote:
  >> For the second point, I think you're correct - in perl world there's
  >> not nearly as many PHPNuke clones available as on the PHP side.
  >> "Elementary" modules (doing for whatever "small" thing), however, I think
  >> are more abundant in Perl (f.ex. how often would you like to be able
  >> to generate PostScript (not just text but with graphics primitives) from
  >> a web application).

  HS> This looks interesting:

  HS> http://www.zend.com/php5/articles/php5-perl.php

  HS> Best of both worlds?

i won't even look. IMNSHO there is no best world with php. it's sole win
is easy creation of simple web sites with db backing. that is a very
narrow but popular niche. but all the work you put into them means you
won't learn proper programming skills as php doesn't support even decent
software engineering concepts like namespaces, etc. my point is why tie
yourself something which won't scale, isn't useful outside its narrow
niche, has many major design flaws, inconsistancy rules, etc. you can go
for it but don't expect any encouragement from me or most here. php is
just a toy that kiddies love. my first rule of design is to isolate
things and php breaks that by merging templates and logic. that may be
simpler for kiddies to play with but it is not how i would design such
things. and i trust my skills over the php 'designers' any time. 

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: 18 Jun 2006 21:35:39 -0700
From: "Hobo Salesman" <hobosalesman@gmail.com>
Subject: Re: File::Find - passing argument to &wanted
Message-Id: <1150691739.870700.9190@f6g2000cwb.googlegroups.com>

Uri Guttman wrote:
> just a toy that kiddies love. my first rule of design is to isolate
> things and php breaks that by merging templates and logic. that may be
> simpler for kiddies to play with but it is not how i would design such
> things. and i trust my skills over the php 'designers' any time.

Well I'll have to mull things over for a while... I have a large web
based app to write in the future that I had planned on using PHP but it
could be Perl would be a better choice.



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

Date: Mon, 19 Jun 2006 04:42:07 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Jun 19 2006
Message-Id: <J13Bq7.22HA@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Alien-wxWidgets-0.13
http://search.cpan.org/~mbarbon/Alien-wxWidgets-0.13/
building, finding and using wxWidgets binaries
----
CGI-FormBuilder-Mail-FormatMultiPart-1.0.1
http://search.cpan.org/~markle/CGI-FormBuilder-Mail-FormatMultiPart-1.0.1/
----
CGI-FormBuilder-Mail-FormatMultiPart-1.0.2
http://search.cpan.org/~markle/CGI-FormBuilder-Mail-FormatMultiPart-1.0.2/
----
CGI-FormBuilder-Mail-FormatMultiPart-1.0.3
http://search.cpan.org/~markle/CGI-FormBuilder-Mail-FormatMultiPart-1.0.3/
----
CGI-FormBuilder-Mail-FormatMultiPart-1.0.4
http://search.cpan.org/~markle/CGI-FormBuilder-Mail-FormatMultiPart-1.0.4/
----
CSS-Squish-0.04
http://search.cpan.org/~tsibley/CSS-Squish-0.04/
Compact many CSS files into one big file
----
Catalyst-Model-SVN-0.05
http://search.cpan.org/~claco/Catalyst-Model-SVN-0.05/
Catalyst Model to browse Subversion repositories
----
Chroniton-0.03
http://search.cpan.org/~jrockway/Chroniton-0.03/
simple backup system with archiving and incremental backups
----
Data-JavaScript-Anon-1.00
http://search.cpan.org/~adamk/Data-JavaScript-Anon-1.00/
Dump big dumb Perl structs to anonymous JavaScript structs
----
Email-Valid-0.174
http://search.cpan.org/~rjbs/Email-Valid-0.174/
Check validity of Internet email addresses
----
Finance-Bank-NetBranch-0.05
http://search.cpan.org/~kulp/Finance-Bank-NetBranch-0.05/
Manage your NetBranch accounts with Perl
----
Geography-Countries-LatLong-0.92
http://search.cpan.org/~lgoddard/Geography-Countries-LatLong-0.92/
mean latitude and longitude
----
Jabber-Lite-0.5
http://search.cpan.org/~beecee/Jabber-Lite-0.5/
Standalone library for communicating with Jabber servers.
----
List-MoreUtils-0.21
http://search.cpan.org/~vparseval/List-MoreUtils-0.21/
Provide the stuff missing in List::Util
----
Mac-PropertyList-SAX-0.01
http://search.cpan.org/~kulp/Mac-PropertyList-SAX-0.01/
work with Mac plists at a low level (with real XML parsers)
----
Net-IPMessenger-0.03
http://search.cpan.org/~masanorih/Net-IPMessenger-0.03/
Interface to the IP Messenger Protocol
----
Oryx-0.24
http://search.cpan.org/~rhundt/Oryx-0.24/
Meta-Model Driven Object Persistance with Multiple Inheritance
----
Parse-MediaWikiDump-0.33
http://search.cpan.org/~triddle/Parse-MediaWikiDump-0.33/
Tools to process MediaWiki dump files
----
Parse-RecDescent-Topiary-0.01
http://search.cpan.org/~ivorw/Parse-RecDescent-Topiary-0.01/
tree surgery for Parse::RecDescent autotrees
----
Sub-Exporter-0.966
http://search.cpan.org/~rjbs/Sub-Exporter-0.966/
a sophisticated exporter for custom-built routines
----
Template-Stash-HTML-Entities-0.01
http://search.cpan.org/~yoshida/Template-Stash-HTML-Entities-0.01/
Encode the value automatically using HTML::Entities
----
Tk-Wizard-Bases-1.945
http://search.cpan.org/~lgoddard/Tk-Wizard-Bases-1.945/
----
URI-Fetch-0.07
http://search.cpan.org/~btrott/URI-Fetch-0.07/
Smart URI fetching/caching
----
WWW-Rafb-0.01
http://search.cpan.org/~amitsides/WWW-Rafb-0.01/
Perl interface for rafb pasting site ( rafb.net/paste )
----
WWW-Search-HGNC-0.01
http://search.cpan.org/~diberri/WWW-Search-HGNC-0.01/
Access HGNC's database of proteins
----
Wx-0.49_07
http://search.cpan.org/~mbarbon/Wx-0.49_07/
interface to the wxWidgets cross-platform GUI toolkit


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Sun, 18 Jun 2006 23:18:48 -0700
From: noob@public.com
Subject: noob asks: differences Activestate 5.8.x vs 5.6.x. pros vs cons of each?
Message-Id: <t7gc925ml27egde24omjoomj96gnk1eq6s@4ax.com>

For a Windows ME system, is there a reason not to use v5.8.8 and use
5.6.1 instead? Also for Win9x or WinXP.


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

Date: 18 Jun 2006 16:05:12 -0700
From: "commandline" <nadigv@gmail.com>
Subject: Office / Adobe programming?
Message-Id: <1150671912.000594.162230@c74g2000cwc.googlegroups.com>

Hi,
I am a newbie who is dabbling with a few things across perl, MS office
and acrobat to automate

1. conversion of Excel, Powerpoint and Word documents into PDFs
2. I need to merge the PDFs into a single pdf and add page numbers.

I used Perl Win32::OLE module to do task 1.

However, I dunno if its possible to access Adobe classes/objects from
Perl to accomplish task 2. Any suggestions to do this is appreciated.



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

Date: Mon, 19 Jun 2006 03:59:51 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Office / Adobe programming?
Message-Id: <7ighm3-07d.ln1@osiris.mauzo.dyndns.org>


Quoth "commandline" <nadigv@gmail.com>:
       ^^^^^^^^^^^
Just a suggestion: people here are more likely to take you seriously if
you use your real name.

> I am a newbie who is dabbling with a few things across perl, MS office
> and acrobat to automate
> 
> 1. conversion of Excel, Powerpoint and Word documents into PDFs
> 2. I need to merge the PDFs into a single pdf and add page numbers.
> 
> I used Perl Win32::OLE module to do task 1.
> 
> However, I dunno if its possible to access Adobe classes/objects from
> Perl to accomplish task 2. Any suggestions to do this is appreciated.

If Acrobat (I assume you have the full version?) exports an OLE
interface, you can automate it in the same way as Office. Otherwise, you
may have more success with Ghostscript and pstools, which google can
find for you.

Ben

-- 
               We do not stop playing because we grow old; 
                  we grow old because we stop playing.
                         benmorrow@tiscali.co.uk


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

Date: 18 Jun 2006 22:01:08 -0700
From: "Deepu" <pradeep.bg@gmail.com>
Subject: Printing hash in table format
Message-Id: <1150693268.338060.317490@p79g2000cwp.googlegroups.com>

I am trying to print hash of hashes in table format on to the screen or

to a file. But am not able to get how this can be achieved. Can
somebody please help me on this.

Now i am printing a hash of hashes using:

while (($key, $value) = each %hash) {
  print ("%-20s => %d\n", $key, $value);

}

The keys and values is actually:

"TEST1-TEST2" => '2'
"TEST2-TEST3" => '3'
"TEST1-TEST3" => '1'
"TEST2-TEST1" => '0'

I need to put the key and values in atable format like:


STATES  TEST1   TEST2    TEST3


TEST1       2            1            3


TEST2       1            0            0


TEST3       4            6            3

Background:

There is actually a main table (in a file) with the static transitions
like:


STATES   TEST1    TEST2    TEST3   TEST4
TEST1        Y             N            N          Y
TEST2        N             Y            Y          N
TEST3        N             N            N          Y
TEST4        Y             Y            Y          N


Y -Possible
N - Not possible
I need to count how many possible and not possible transitions have
occured with respect tp each transition.
and i will also have another file which will have some actual
transitions like:


TEST1
TEST3
TEST2
TEST1
TEST4


(This actually meant the present state is TEST1 then next state is
TEST3, then the present state is TEST3 and next state is TEST2 and so
on).


What i did was put the main table in a hash and also the actual
transitions file in a hash, compare both and print out the hash like


%hash = ( "TEST1-TEST2" => 0
                "TEST2-TEST3" => 1
                "TEST3-TEST4" => 2
                "TEST4-TEST5" => 1
              )


The numbers indicate how many times the transition has occured in
actual transition file.


Now i need to put this hash again in a table format.


 STATES  TEST1   TEST2    TEST3


TEST1       2            1            3


TEST2       1            0            0


TEST3       4            6            3 


Thanks
Pradeep



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

Date: 19 Jun 2006 01:20:55 -0700
From: "Hobo Salesman" <hobosalesman@gmail.com>
Subject: Re: Printing hash in table format
Message-Id: <1150705255.338579.69630@c74g2000cwc.googlegroups.com>

Deepu wrote:
> I am trying to print hash of hashes in table format on to the screen or
>
> to a file. But am not able to get how this can be achieved. Can
> somebody please help me on this.

Theres a lot more skilled people here than me but I can tell you how
I'd approach it anyway. I skimmed over your post and it looks like
basically you want to read tables into data structures, analyze that
data, and write them back out to tables. It's possible theres a module
that does it but I don't know of it.

THeres a lot of ways to structure your data that would depend on what
you want to do with it and how consistently it's structured. Read this:

http://search.cpan.org/dist/perl/pod/perldsc.pod
http://search.cpan.org/dist/perl/pod/perllol.pod

If everything is actually in a nice consistent order (test1, test2,
test3) like that then it should be pretty easy to read files line by
line into a structure you can work with. To count boolean values in an
entry just loop through the array/hash for that entry and set a count
variable for Y and/or N.

Hope some of that helped.

HS



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

Date: Mon, 19 Jun 2006 10:39:26 +0200
From: Anno Siegel <siegel@zrz.tu-berlin.de>
Subject: Re: Printing hash in table format
Message-Id: <4fn69aF1jiqrhU1@news.dfncis.de>

Deepu wrote:

> I am trying to print hash of hashes in table format on to the screen or
> 
> to a file. But am not able to get how this can be achieved. Can
> somebody please help me on this.
> 
> Now i am printing a hash of hashes using:
> 
> while (($key, $value) = each %hash) {
>   print ("%-20s => %d\n", $key, $value);
> 
> }

The code looks like you're printing a plain hash, not a hash of
hashes.  Otherwise, $value would be a hash ref, which can't be
reasonably printed as a number.

> The keys and values is actually:
> 
> "TEST1-TEST2" => '2'
> "TEST2-TEST3" => '3'
> "TEST1-TEST3" => '1'
> "TEST2-TEST1" => '0'
> 
> I need to put the key and values in atable format like:
> 
> 
> STATES  TEST1   TEST2    TEST3
> 
> 
> TEST1       2            1            3
> 
> 
> TEST2       1            0            0
> 
> 
> TEST3       4            6            3

Please explain how you get from the first table to this one.  I don't
see the connection.

Anno


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

Date: 19 Jun 2006 02:48:33 -0700
From: "Nick of course" <mol10metal@hotmail.com>
Subject: Re: Printing hash in table format
Message-Id: <1150710513.203757.148350@y41g2000cwy.googlegroups.com>


Deepu wrote:
> while (($key, $value) = each %hash) {
>   print ("%-20s => %d\n", $key, $value);
> 
> }
Should be printf not print



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

Date: Mon, 19 Jun 2006 09:02:34 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: question on printing to /dev/lp
Message-Id: <44964c0c$0$16037$e4fe514c@dreader20.news.xs4all.nl>

Hi,

I want to print my output to a printer and not to screen. In the FAQ I 
read about filehandles. Do I open printers the same way as files or 
differently? And how about ejecting a sheet from the printer? Is there a 
command for it?

Thanks,

Huub


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

Date: Mon, 19 Jun 2006 11:32:36 +0200
From: Anno Siegel <siegel@zrz.tu-berlin.de>
Subject: Re: question on processing mysql
Message-Id: <4fn9cvF1jni6pU1@news.dfncis.de>

Huub <"v.niekerk at hccnet.nl"> wrote:

> Ok, found the problems....had $ where I should use @ and used the wrong
> recordnumber.
> Other question:

If you have a new question, please start another thread with a
meaningful subject.

> which function should I use to print to a printer? 
> FileHandle or IO:: ?

These aren't functions, they are modules (with benevolent interpretation
of "IO::").  What makes you think it makes a difference which one you
use specifically with a printer?

Anno


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

Date: 18 Jun 2006 16:18:55 -0700
From: "Larry" <larry.grant.dc@gmail.com>
Subject: Re: Tk bug not fixed in CPAN
Message-Id: <1150672735.113418.198910@y41g2000cwy.googlegroups.com>


zentara wrote:
> On 14 Jun 2006 22:35:40 -0700, "Larry" <larry.grant.dc@gmail.com> wrote:
>
> >I experiencing a Tk bug, whereby starting another program would crash
> >my Tk program.  I found a description of the bug here:
> >http://tinyurl.com/zbej3  and installed the patch it recommended
> >(http://m19s28.vlinux.de/estel/debian/perl-tk.deb), and it seems to
> >have worked.
> >
> >My question is: why hasn't Tk been updated in CPAN to include this fix?
> > The bug description describes the severity as "Critical" (and rightly
> >so!), and the patch file is dated Jan. 2006.  The Tk I used was just
> >installed from CPAN a few days ago.
>
> Yeah, I notice the same thing. Nick will say he has made the changes
> to his sources to reflect the bug-fix, but it is never updated in the
> latest download.
>
> Maybe you can re-post this question in comp.lang.perl.tk, where
> Nick Ing-Simmons frequently responds.

I tried that, as well as sending an email directly to Nick.   No
response.

Regardless of the bug, just the fact that a module as major as a Tk has
not been updated on CPAN since '04 is troubling.  I would expect that
someone here would have something to say about this.



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

Date: 19 Jun 2006 10:19:05 +0200
From: torbenm@app-3.diku.dk (=?iso-8859-1?q?Torben_=C6gidius_Mogensen?=)
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <7zhd2himme.fsf@app-3.diku.dk>

Raffael Cavallaro <raffaelcavallaro@pas-d'espam-s'il-vous-plait-mac.com> writes:

> This is purely a matter of programming style. For explorative
> programming it is easier to start with dynamic typing and add static
> guarantees later rather than having to make decisions about
> representation and have stubs for everything right from the start.

I think you are confusing static typing with having to write types
everywhere.  With type inference, you only have to write a minimum of
type information (such as datatype declarations), so you can easily do
explorative progrmming in such languages -- I don't see any advantage
of dynamic typing in this respect.

> The
> lisp programming style is arguably all about using heterogenous lists
> and forward references in the repl for everything until you know what
> it is that you are doing, then choosing a more appropriate
> representation and filling in forward references once the program
> gels. Having to choose representation right from the start and needing
> working versions (even if only stubs) of *every* function you call may
> ensure type correctness, but many programmers find that it also
> ensures that you never find the right program to code in the first
> place.

If you don't have definitions (stubs or complete) of the functions you
use in your code, you can only run it up to the point where you call
an undefined function.  So you can't really do much exploration until
you have some definitions.

I expect a lot of the exploration you do with incomplete programs
amount to the feedback you get from type inference.

> This is because you don't have the freedom to explore possible
> solutions without having to break your concentration to satisfy the
> nagging of a static type checker.

I tend to disagree.  I have programmed a great deal in Lisp, Scheme,
Prolog (all dynamically typed) and SML and Haskell (both statically
typed).  And I don't find that I need more stubs etc. in the latter.
In fact, I do a lot of explorative programming when writing programs
in ML and Haskell.  And I find type inference very helpful in this, as
it guides the direction of the exploration, so it is more like a
safari with a local guide than a blindfolded walk in the jungle.

        Torben


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

Date: 19 Jun 2006 01:48:10 -0700
From: "Rob Thorpe" <robert.thorpe@antenova.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1150706890.543243.284430@h76g2000cwa.googlegroups.com>

Torben =C6gidius Mogensen wrote:
> "Rob Thorpe" <robert.thorpe@antenova.com> writes:
>
> > Torben =C6gidius Mogensen wrote:
>
> > > That's the point: Bugs that in dynamically typed languages would
> > > require testing to find are found by the compiler in a statically
> > > typed language.  So whil eit may take onger to get a program thatgets
> > > past the compiler, it takes less time to get a program that works.
> >
> > In my experience the opposite is true for many programs.
> > Having to actually know the precise type of every variable while
> > writing the program is not necessary, it's a detail often not relevant
> > to the core problem. The language should be able to take care of
> > itself.
> >
> > In complex routines it can be useful for the programmer to give types
> > and for the compiler to issue errors when they are contradicted.  But
> > for most routines it's just an unnecessary chore that the compiler
> > forces on the programmer.
>
> Indeed.  So use a language with type inference.

Well, for most purposes that's the same as dynamic typing since the
compiler doesn't require you to label the type of your variables.  I
occasionally use CMUCL and SBCL which do type inference, which is
useful at improving generated code quality.  It also can warn the
programmer if they if they reuse a variable in a context implying that
it's a different type which is useful.

I see type inference as an optimization of dynamic typing rather than a
generalization of static typing.  But I suppose you can see it that way
around.



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

Date: 19 Jun 2006 12:03:29 +0200
From: torbenm@app-3.diku.dk (=?iso-8859-1?q?Torben_=C6gidius_Mogensen?=)
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <7zy7vt1mz2.fsf@app-3.diku.dk>

"Rob Thorpe" <robert.thorpe@antenova.com> writes:

> Torben Ęgidius Mogensen wrote:
> > "Rob Thorpe" <robert.thorpe@antenova.com> writes:
> >
> > > Torben Ęgidius Mogensen wrote:
> >
> > Indeed.  So use a language with type inference.
> 
> Well, for most purposes that's the same as dynamic typing since the
> compiler doesn't require you to label the type of your variables.

That's not really the difference between static and dynamic typing.
Static typing means that there exist a typing at compile-time that
guarantess against run-time type violations.  Dynamic typing means
that such violations are detected at run-time.  This is orthogonal to
strong versus weak typing, which is about whether such violations are
detected at all.  The archetypal weakly typed language is machine code
-- you can happily load a floating point value from memory, add it to
a string pointer and jump to the resulting value.  ML and Scheme are
both strongly typed, but one is statically typed and the other
dynamically typed.

Anyway, type inference for statically typed langauges don't make them
any more dynamically typed.  It just moves the burden of assigning the
types from the programmer to the compiler.  And (for HM type systems)
the compiler doesn't "guess" at a type -- it finds the unique most
general type from which all other legal types (within the type system)
can be found by instantiation.

>  I
> occasionally use CMUCL and SBCL which do type inference, which is
> useful at improving generated code quality.  It also can warn the
> programmer if they if they reuse a variable in a context implying that
> it's a different type which is useful.
> 
> I see type inference as an optimization of dynamic typing rather than a
> generalization of static typing.  But I suppose you can see it that way
> around.

Some compilers for dynamically typed languages will do a type analysis
similar to type inference, but they will happily compile a program
even if they can't guarantee static type safety.

Such "type inference" can be seen as an optimisation of dynamic
typing, as it allows the compiler to omit _some_ of the runtime type
checks.  I prefer the term "soft typing" for this, though, so as not
to confuse with static type inference.

Soft typing can give feedback similar to that of type inference in
terms of identifying potential problem spots, so in that respect it is
similar to static type inference, and you might get similar fast code
development.  You miss some of the other benefits of static typing,
though, such as a richer type system -- soft typing often lacks
features like polymorphism (it will find a set of monomorphic
instances rather than the most general type) and type classes.

        Torben



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

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 9313
***************************************


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