[28089] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9453 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 12 06:05:49 2006

Date: Wed, 12 Jul 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           Wed, 12 Jul 2006     Volume: 10 Number: 9453

Today's topics:
        Capture a frame from AVI/MOV pjsenthil@gmail.com
    Re: Capture a frame from AVI/MOV <mumia.w.18.spam+nospam.usenet@earthlink.net>
        generating perl code from awk <farhat@hotmail.com>
    Re: generating perl code from awk anno4000@radom.zrz.tu-berlin.de
    Re: generating perl code from awk <farhat@hotmail.com>
    Re: generating perl code from awk <bugbear@trim_papermule.co.uk_trim>
    Re: generating perl code from awk anno4000@radom.zrz.tu-berlin.de
        multiple array parameters to object methods? en2guy@hotmail.co.uk
    Re: multiple array parameters to object methods? anno4000@radom.zrz.tu-berlin.de
        new CPAN modules on Wed Jul 12 2006 (Randal Schwartz)
    Re: Perl +lists/unions/intersection: <veatchla@yahoo.com>
    Re: RSS feeds and HTML special characters <flavell@physics.gla.ac.uk>
    Re: RSS feeds and HTML special characters <flavell@physics.gla.ac.uk>
    Re: Strange syntax error <tseitlin@gmail.com>
    Re: Translate code or compile a win DLL <venom.zero.zero@gmail.com>
    Re: What is a type error? <marshall.spight@gmail.com>
    Re: What is a type error? <rossberg@ps.uni-sb.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 11 Jul 2006 22:52:01 -0700
From: pjsenthil@gmail.com
Subject: Capture a frame from AVI/MOV
Message-Id: <1152683521.210551.203630@75g2000cwc.googlegroups.com>

Hi,


       I am writing code in CGI-perl,in which i am want to capture
frames from a media player which runs mpeg or any video.(mov file in
Quick time).'

the purpose of doing this is to generate thumbnails (snapshot ) of the
video when it is in the play mode..

Friends pl help..Becoz i am not familiar in working on images.

Regards
Senthil



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

Date: Wed, 12 Jul 2006 09:34:26 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Capture a frame from AVI/MOV
Message-Id: <Cm3tg.3497$vO.453@newsread4.news.pas.earthlink.net>

pjsenthil@gmail.com wrote:
> Hi,
> 
> 
>        I am writing code in CGI-perl,in which i am want to capture
> frames from a media player which runs mpeg or any video.(mov file in
> Quick time).'
> 
> the purpose of doing this is to generate thumbnails (snapshot ) of the
> video when it is in the play mode..
> 
> Friends pl help..Becoz i am not familiar in working on images.
> 
> Regards
> Senthil
> 

Perhaps you should get mplayer and investigate 
mplayer's command line parameters. Because mplayer 
creates something other than a normal X Window, you'll 
probably not be able to simply take a snapshot of the 
window image. Instead, you'll want to command mplayer 
to output one of the video frames to disk.

HTH



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

Date: Wed, 12 Jul 2006 03:14:55 -0400
From: Farhat Habib <farhat@hotmail.com>
Subject: generating perl code from awk
Message-Id: <e927hg$mdu$1@charm.magnus.acs.ohio-state.edu>

Hi,

I have rather simple awk script which I would like to convert to Perl. I 
am using a2p but unfortunately it gives me a syntax error.

----
syntax error in file tntvenn.awk at line 22
Translation aborted due to syntax errors.
----


   for ( char in chars )
   { common = 1 ; out = ""
     for ( name in names )
=>      if ( (name,char) in data )
         out = out char ": " data[name,char] "\n"
       else
         common = 0
     if ( common )
       print out
   }
}

Line 22 is the line starting with =>

Any clues as to what's problem?

Thanks,
-F


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

Date: 12 Jul 2006 07:25:58 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: generating perl code from awk
Message-Id: <4hjmg6F1s5hf4U1@news.dfncis.de>

Farhat Habib  <farhat@hotmail.com> wrote in comp.lang.perl.misc:
> Hi,
> 
> I have rather simple awk script which I would like to convert to Perl. I 
> am using a2p but unfortunately it gives me a syntax error.
> 
> ----
> syntax error in file tntvenn.awk at line 22
> Translation aborted due to syntax errors.
> ----
> 
> 
>    for ( char in chars )
>    { common = 1 ; out = ""
>      for ( name in names )
> =>      if ( (name,char) in data )
>          out = out char ": " data[name,char] "\n"
>        else
>          common = 0
>      if ( common )
>        print out
>    }
> }
> 
> Line 22 is the line starting with =>

That is incorrect awk code.  The "in" keyword is only valid in a "for"
statement, not with "if".

Anno


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

Date: Wed, 12 Jul 2006 03:43:32 -0400
From: Farhat Habib <farhat@hotmail.com>
Subject: Re: generating perl code from awk
Message-Id: <e92974$mfb$1@charm.magnus.acs.ohio-state.edu>

anno4000@radom.zrz.tu-berlin.de wrote:
> Farhat Habib  <farhat@hotmail.com> wrote in comp.lang.perl.misc:
> 
>>Hi,
>>
>>I have rather simple awk script which I would like to convert to Perl. I 
>>am using a2p but unfortunately it gives me a syntax error.
>>
>>----
>>syntax error in file tntvenn.awk at line 22
>>Translation aborted due to syntax errors.
>>----
>>
>>
>>   for ( char in chars )
>>   { common = 1 ; out = ""
>>     for ( name in names )
>>=>      if ( (name,char) in data )
>>         out = out char ": " data[name,char] "\n"
>>       else
>>         common = 0
>>     if ( common )
>>       print out
>>   }
>>}
>>
>>Line 22 is the line starting with =>
> 
> 
> That is incorrect awk code.  The "in" keyword is only valid in a "for"
> statement, not with "if".
> 

It seems to work with GNU awk. Is there a replacement for this that 
would work with a2p?

Thanks,

-F


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

Date: Wed, 12 Jul 2006 09:39:47 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: generating perl code from awk
Message-Id: <44b4b553$0$22085$ed2619ec@ptn-nntp-reader01.plus.net>

Farhat Habib wrote:
>>> Line 22 is the line starting with =>
>>
>>
>>
>> That is incorrect awk code.  The "in" keyword is only valid in a "for"
>> statement, not with "if".
>>
> 
> It seems to work with GNU awk. Is there a replacement for this that 
> would work with a2p?

The converter was written to manage "original" awk code.

Fortunately for you, gawk (Gnu Awk) has a mode that
is (reasonably) compatible with this.

-W compat
        -W traditional
        --compat
        --traditional
               Run in compatibility mode.  In compatibility mode, gawk behaves identically to UNIX awk; none
               of  the  GNU-specific  extensions are recognized.  The use of --traditional is preferred over
               the other forms of this option.  See GNU EXTENSIONS, below, for more information.

Get your code to run under this, and it has a much better chance
of converting.

Alternatively, just write your prog in perl in the first place.

  BugBear


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

Date: 12 Jul 2006 09:13:13 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: generating perl code from awk
Message-Id: <4hjsp9F1s1o4aU1@news.dfncis.de>

Farhat Habib  <farhat@hotmail.com> wrote in comp.lang.perl.misc:
> anno4000@radom.zrz.tu-berlin.de wrote:
> > Farhat Habib  <farhat@hotmail.com> wrote in comp.lang.perl.misc:
> > 
> >>Hi,
> >>
> >>I have rather simple awk script which I would like to convert to Perl. I 
> >>am using a2p but unfortunately it gives me a syntax error.

[...]

> > That is incorrect awk code.  The "in" keyword is only valid in a "for"
> > statement, not with "if".
> > 
> 
> It seems to work with GNU awk. Is there a replacement for this that 
> would work with a2p?

Good question, wrong newsgroup.

Anno


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

Date: 12 Jul 2006 02:14:29 -0700
From: en2guy@hotmail.co.uk
Subject: multiple array parameters to object methods?
Message-Id: <1152695669.012265.144380@35g2000cwc.googlegroups.com>

Hi-

trying to understand object oriented perl, and have been wondering
about passing arrays as parameters to object methods.

If I pass a single array as a method parameter, it's fine, eg

$object->raiseFlags(@flags);

However, if I wanted to pass 2 arrays to an object method, I would have
to use references to objects, I think, since

$object->raiseFlags(@flags, @specialOccasions);

would append @specialOccasions to @flags to make a big jumbled list.

Are there any issues to using references as method parameters when
using objects in perl? Is there a better way to approach the problem?

Thanks



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

Date: 12 Jul 2006 09:23:46 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: multiple array parameters to object methods?
Message-Id: <4hjtd2F1s1o4aU2@news.dfncis.de>

 <en2guy@hotmail.co.uk> wrote in comp.lang.perl.misc:
> Hi-
> 
> trying to understand object oriented perl, and have been wondering
> about passing arrays as parameters to object methods.
> 
> If I pass a single array as a method parameter, it's fine, eg
> 
> $object->raiseFlags(@flags);
> 
> However, if I wanted to pass 2 arrays to an object method, I would have
> to use references to objects, I think, since

Not to objects, necessarily, but array refs are the standard way
of handing in more than one array to a perl sub.  Whether the sub
is a method or not is irrelevant.

> $object->raiseFlags(@flags, @specialOccasions);
> 
> would append @specialOccasions to @flags to make a big jumbled list.
> 
> Are there any issues to using references as method parameters when
> using objects in perl?

No.

> Is there a better way to approach the problem?

Other ways, yes.  Better, no.

Anno


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

Date: Wed, 12 Jul 2006 04:42:07 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Jul 12 2006
Message-Id: <J29x27.31p@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.

Alvis-Pipeline-0.09
http://search.cpan.org/~mirk/Alvis-Pipeline-0.09/
Perl extension for passing XML documents along the Alvis pipeline
----
Apache-Session-Wrapper-0.31
http://search.cpan.org/~drolsky/Apache-Session-Wrapper-0.31/
A simple wrapper around Apache::Session
----
CPAN-Mini-0.500
http://search.cpan.org/~rjbs/CPAN-Mini-0.500/
create a minimal mirror of CPAN
----
Catalyst-Plugin-ConfigLoader-0.1
http://search.cpan.org/~bricas/Catalyst-Plugin-ConfigLoader-0.1/
Load config files of various types
----
Catalyst-Plugin-ConfigLoader-0.11
http://search.cpan.org/~bricas/Catalyst-Plugin-ConfigLoader-0.11/
Load config files of various types
----
Class-DBI-ViewLoader-Pg-0.05
http://search.cpan.org/~mattlaw/Class-DBI-ViewLoader-Pg-0.05/
Class::DBI::Viewloader implementation for Postgresql.
----
DBIx-Class-Schema-Loader-0.03004
http://search.cpan.org/~blblack/DBIx-Class-Schema-Loader-0.03004/
Dynamic definition of a DBIx::Class::Schema
----
Devel-TraceUse-1.00
http://search.cpan.org/~chromatic/Devel-TraceUse-1.00/
show the modules your program loads, recursively
----
Email-Address-1.85
http://search.cpan.org/~rjbs/Email-Address-1.85/
RFC 2822 Address Parsing and Creation
----
Email-Folder-IMAP-1.10
http://search.cpan.org/~rjbs/Email-Folder-IMAP-1.10/
Email::Folder Access to IMAP Folders
----
Email-Folder-IMAPS-1.10
http://search.cpan.org/~rjbs/Email-Folder-IMAPS-1.10/
Email::Folder Access to IMAP over SSL Folders
----
Email-LocalDelivery-0.20
http://search.cpan.org/~rjbs/Email-LocalDelivery-0.20/
Deliver a piece of email - simply
----
Email-MessageID-1.35
http://search.cpan.org/~rjbs/Email-MessageID-1.35/
Generate world unique message-ids.
----
Email-Simple-1.94
http://search.cpan.org/~rjbs/Email-Simple-1.94/
Simple parsing of RFC2822 message format and headers
----
Email-Simple-Creator-1.41
http://search.cpan.org/~rjbs/Email-Simple-Creator-1.41/
Email::Simple constructor for starting anew.
----
Email-Simple-Headers-1.02
http://search.cpan.org/~rjbs/Email-Simple-Headers-1.02/
Get a List of Headers From Simple Objects
----
Expect-1.18
http://search.cpan.org/~rgiersig/Expect-1.18/
----
FFmpeg-0.04
http://search.cpan.org/~allenday/FFmpeg-0.04/
Perl interface to FFmpeg, a video converter written in C
----
FFmpeg-5704
http://search.cpan.org/~allenday/FFmpeg-5704/
Perl interface to FFmpeg, a video converter written in C
----
File-BOM-0.12
http://search.cpan.org/~mattlaw/File-BOM-0.12/
Utilities for handling Byte Order Marks
----
Gtk2-Ex-PodViewer-0-16
http://search.cpan.org/~gbrown/Gtk2-Ex-PodViewer-0-16/
----
Gtk2-Ex-PodViewer-0.16
http://search.cpan.org/~gbrown/Gtk2-Ex-PodViewer-0.16/
a Gtk2 widget for displaying Plain old Documentation (POD).
----
JavaScript-1.00_01
http://search.cpan.org/~claesjac/JavaScript-1.00_01/
Perl extension for executing embedded JavaScript
----
MP3-Find-0.06
http://search.cpan.org/~peichman/MP3-Find-0.06/
Search and sort MP3 files based on their ID3 tags
----
Mail-Mbox-MessageParser-1.4004
http://search.cpan.org/~dcoppit/Mail-Mbox-MessageParser-1.4004/
A fast and simple mbox folder reader
----
Module-Dependency-1.84
http://search.cpan.org/~timb/Module-Dependency-1.84/
Collection of modules for examining dependencies between parents and children, like Perl files
----
Module-Pluggable-3.1
http://search.cpan.org/~simonw/Module-Pluggable-3.1/
automatically give your module the ability to have plugins
----
Net-Server-0.94
http://search.cpan.org/~rhandom/Net-Server-0.94/
Extensible, general Perl server engine
----
Oracle-SQLLoader-0.9
http://search.cpan.org/~ezra/Oracle-SQLLoader-0.9/
object interface to Oracle's sqlldr
----
Perl-Critic-Bangs-0.01
http://search.cpan.org/~petdance/Perl-Critic-Bangs-0.01/
A collection of handy Perl::Critic policies
----
SWF-Chart-1.4
http://search.cpan.org/~garth/SWF-Chart-1.4/
Perl interface to the SWF Chart generation tool
----
SystemPerl-1.270
http://search.cpan.org/~wsnyder/SystemPerl-1.270/
SystemPerl Language Extension to SystemC
----
Test-Dependencies-0.03
http://search.cpan.org/~zev/Test-Dependencies-0.03/
Ensure that your Makefile.PL specifies all module dependencies
----
Text-MeCab-0.09
http://search.cpan.org/~dmaki/Text-MeCab-0.09/
Alternate Interface To libmecab
----
Text-Restructured-0.003015
http://search.cpan.org/~nodine/Text-Restructured-0.003015/
----
Text-Tabs+Wrap-2006.0711
http://search.cpan.org/~muir/Text-Tabs+Wrap-2006.0711/
----
Thread-Cancel-1.01
http://search.cpan.org/~jdhedden/Thread-Cancel-1.01/
Cancel (i.e., kill) threads
----
Thread-Suspend-1.01
http://search.cpan.org/~jdhedden/Thread-Suspend-1.01/
Suspend and resume operations for threads
----
VOIP-VOIPBuster-0.01
http://search.cpan.org/~kulp/VOIP-VOIPBuster-0.01/
Makes (limited) calls using VOIPBuster.
----
VOIP-VOIPBuster-0.02
http://search.cpan.org/~kulp/VOIP-VOIPBuster-0.02/
Makes (limited) calls using VOIPBuster.
----
XML-Feed-0.09
http://search.cpan.org/~btrott/XML-Feed-0.09/
Syndication feed parser and auto-discovery
----
text_hunspell_1.0
http://search.cpan.org/~eleonora/text_hunspell_1.0/
----
threads-1.36
http://search.cpan.org/~jdhedden/threads-1.36/
Perl interpreter-based threads


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: Tue, 11 Jul 2006 23:17:06 -0500
From: l v <veatchla@yahoo.com>
Subject: Re: Perl +lists/unions/intersection:
Message-Id: <e91t3s$jea$1@emma.aioe.org>

oleg wrote:
> Hello,
> 
> 
> Could you please help me to solve the following problem.

[snip]
> 
> Here is an example:
> 
> Combine seven lists below into new lists.  New lists must contain less
> then   10  elements
> list_1:  { a, b, c, d ,e }
> list_2:  { c, d, a, g }
> list_3:  { a, g, s, h, y }
> list_4:  { t, r, n, l, o }
> list_5:  { c, f, g, s, w, y }
> list_6:  { n, y, r, s }
> list_7:  { k, b, s }
> 
> list_1+list_2:    		{ a, b, c, d, e, g }
> list_3 + list_5; 	 	{ a, g, s, h, y, c, f, w, y }
> list_4 + list_6 + list_7:	{ t, r, n, l, o, y, s, k, b }
> 
> Thank you!
> Oleg
> 

List::Compare may be what you are looking for to get the union of two lists.

-- 

Len


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

Date: Wed, 12 Jul 2006 10:06:47 +0100
From: "Alan J. Flavell" <flavell@physics.gla.ac.uk>
Subject: Re: RSS feeds and HTML special characters
Message-Id: <Pine.LNX.4.64.0607120947400.3038@ppepc87.ph.gla.ac.uk>

On Wed, 12 Jul 2006, John Bokma wrote:

> If you use A. Sinan Unur's solution, as far as I know you still have 
> to specify somewhere that the HTML document should be rendered as 
> having utf8, since &#8217; is just a fancy way of writing an utf 
> character.

This is precisely the conceptual error which existed in all versions 
of Netscape 4.*.  Fortunately, I think we can forget that old thing 
for most practical purposes today.

It's an important principle (see RFC2070 for the original 
codification, or HTML/4.01 specification for a more current version of 
the story) that the "document character set" of HTML is always, in 
principle, Unicode, no matter what character encoding it uses (e.g the 
numerical values that appear in &#number;  notation don't change, not 
even if you re-code the document in EBCDIC).  And of course the more 
common situations, where the document is encoded in one of the 
iso-8859-somthing codes, or even in us-ascii, are precisely the times 
when you *do* need &#number; notation to represent the occasional 
character which is outside of the chosen character encoding.

Don't confuse "character set" with "character encoding" - not even if 
the old MIME terminology uses the attribute name "charset" to specify 
the character encoding - they are two fundamentally different things, 
and already were in SGML, although it's only more recently that the 
distinction has become so widely significant - it's a shame that the 
MIME specifications introduced this confusion, but too late to repair 
it now I guess.

So much for principles.  In practical terms, if you are involved in 
handling forms submissions then it's mostly a good idea to choose 
utf-8 encoding anyway, and this will incidentally be helpful for any 
old NN4.* versions which are still shambling around.  But, aside from 
those practical issues, the theory is clear, as above, the display 
(if the data is correct!) will be correct in any halfways decent 
current browser - but you might need to be a bit more resourceful in
handling user input via forms, as commented in the Perl encoding 
documentation: 

|| it is beyond the power of words to describe the 
|| way HTML browsers encode non-ASCII  form data. 

Hope this clears things up a bit.

-- 

  If the crash doesn't occur immediately, the [development] cycle is broken,
  and the result is called a release.  --  detha, in the monastery.


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

Date: Wed, 12 Jul 2006 10:20:00 +0100
From: "Alan J. Flavell" <flavell@physics.gla.ac.uk>
Subject: Re: RSS feeds and HTML special characters
Message-Id: <Pine.LNX.4.64.0607121011580.3038@ppepc87.ph.gla.ac.uk>

On Tue, 11 Jul 2006, Mumia W. wrote:

> > <title>This Artist is Good - Frank D&#8217;Armata</title>

> (0x8217 is a unicode character),

So it would be, but it's not &#8217;

The values in &#number; notation are decimal (8217 = 0x2019, "right 
single quotation mark).

To use hexadecimal numerical character references, code e.g &#x2019;

> but STDOUT wasn't warned to look
> out for unicode (muti-byte, wide) characters.

Don't confuse the real characters with their numerical character 
references.  In HTML or any XML-based language they are different
ways of representing the same thing, but &-notation can be used even
when the character encoding is us-ascii, whereas the "real" character
itself obviously needs a correct character encoding to be in effect,
and then your remark about STDOUT is pertinent.

h t h



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

Date: 12 Jul 2006 01:21:03 -0700
From: "Art" <tseitlin@gmail.com>
Subject: Re: Strange syntax error
Message-Id: <1152692463.644699.205020@35g2000cwc.googlegroups.com>

As suspected, known bug.
http://rt.perl.org/rt3//Public/Bug/Display.html?id=34233

Art wrote:
> Thanks, worked perfectly.
>
> Just out of interest, I analyzed it a bit further, it turns out the '/'
> operator is what makes Switch  to fail. In that specific case there are
> possible work-arounds: using '*0.000001' instead of '/1000000' or
> adding '#/' after the problematic line.
> I wonder if this is a known bug?
>
>
> anno4000@radom.zrz.tu-berlin.de wrote:
> >
> > Well, the Switch module uses a source filter to do its thing.  Strange
> > things can happen with that.  Switch.pm is a nice proof of concept,
> > but it's rarely a real advantage over other methods.  In your case, a
> > simple hash table can be used to hold the information needed in the
> > several branches.  Untested:
> >
> >     {
> >         my %mode_tab = (
> >             'r' => [ '<', 'read'],
> >             'w' => [ '>', 'write'],
> >             'a' => [ '>>', 'append to'],
> >         );
> >
> >         sub openFile {
> >             my ( $file, $mode) = @_;
> >             warn "wrong or unsupported mode: use 'r', 'w' or 'a'" unless
> >                 $mode_tab{ $mode};
> >             my ( $how, $what) = @{ $mode_tab{ $mode} };
> >             open my $fh, $how, $file or
> >                 warn "Can't $what file '$file': $!";
> >             return $fh;
> >         }
> >     }
> > 
> > Anno



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

Date: 12 Jul 2006 01:26:34 -0700
From: "VeNoM00" <venom.zero.zero@gmail.com>
Subject: Re: Translate code or compile a win DLL
Message-Id: <1152692794.407003.79400@p79g2000cwp.googlegroups.com>

> Google PageRank is not an obscure or new service... Surely there must be
> similar libraries in your target language(s) already???

No it is obscure. This is obtained with a reverse engineering operation
on the google toolbar. by the way i found the code in PHP and it's more
simple to translate for me. But i've problem with types :/

i you're interested http://rafb.net/paste/results/nwhWSy74.html

Thanks



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

Date: 11 Jul 2006 21:09:48 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is a type error?
Message-Id: <1152677387.981169.11390@35g2000cwc.googlegroups.com>

Joachim Durchholz wrote:
> Marshall schrieb:
> > Now, I'm not fully up to speed on DBC. The contract specifications,
> > these are specified statically, but checked dynamically, is that
> > right?
>
> That's how it's done in Eiffel, yes.
>
>  > In other words, we can consider contracts in light of
> > inheritance, but the actual verification and checking happens
> > at runtime, yes?
>
> Sure. Though, while DbC gives rules for inheritance (actually subtypes),
> these are irrelevant to the current discussion; DbC-minus-subtyping can
> still be usefully applied.

Yes, subtyping. Of course I meant to say subtyping.<blush>

I can certainly see how DbC would be useful without subtyping.
But would there still be a reason to separate preconditions
from postconditions? I've never been clear on the point
of differentiating them (beyond the fact that one's covariant
and the other is contravariant.)


> > Wouldn't it be possible to do them at compile time? (Although
> > this raises decidability issues.)
>
> Exactly, and that's why you'd either uses a restricted assertion
> language (and essentially get something that's somewhere between a type
> system and traditional assertion); or you'd use some inference system
> and try to help it along (not a simple thing either - the components of
> such a system exist, but I'm not aware of any system that was designed
> for the average programmer).

As to the average programmer, I heard this recently on
comp.databases.theory:

"Don't blame me for the fact that competent programming, as I view it
as an intellectual possibility, will be too difficult for "the
average programmer"  -you must not fall into the trap of rejecting
a surgical technique because it is beyond the capabilities of the
barber in his shop around the corner."   -- EWD512


>  > Mightn't it also be possible to
> > leave it up to the programmer whether a given contract
> > was compile-time or runtime?
>
> I'd agree with that, but I'm not sure how well that would hold up in
> practice.

I want to try it and see what it's like.


Marshall



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

Date: Wed, 12 Jul 2006 11:21:59 +0200
From: Andreas Rossberg <rossberg@ps.uni-sb.de>
Subject: Re: What is a type error?
Message-Id: <e92evn$a11al$1@hades.rz.uni-saarland.de>

David Hopwood wrote:
> George Neuner wrote:
>>
>>All of this presupposes that you have a high level of confidence in
>>the compiler.  I've been in software development for going in 20 years
>>now and worked 10 years on high performance, high availability
>>systems.  In all that time I have yet to meet a compiler ... or
>>significant program of any kind ... that is without bugs, noticeable
>>or not.
> 
> [...]
> 
> One of the main reasons for this, IMHO, is that many compilers place too
> much emphasis on low-level optimizations of dubious merit. For C and
> Java, I've taken to compiling all non-performance-critical code without
> optimizations, and that has significantly reduced the number of compiler
> bugs that I see. It has very little effect on overall execution performance
> (and compile times are quicker).
> 
> I don't think that over-complex type systems are the cause of more than a
> small part of the compiler bug problem. In my estimation, the frequency of
> bugs in different compilers *for the same language* can vary by an order of
> magnitude.

Also, the use of typed intermediate languages within the compiler might 
actually help drastically cutting down on the more severe problem of 
code transformation bugs, notwithstanding the relative complexity of 
suitable internal type systems.

   - Andreas


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

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


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