[28082] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9446 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 11 03:05:44 2006

Date: Tue, 11 Jul 2006 00:05:04 -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           Tue, 11 Jul 2006     Volume: 10 Number: 9446

Today's topics:
        new CPAN modules on Tue Jul 11 2006 (Randal Schwartz)
        perltoot bug? himanshu.garg@gmail.com
    Re: processing large numbers/values/figures <abigail@abigail.nl>
    Re: processing large numbers/values/figures <ruf@rawip.org>
    Re: processing large numbers/values/figures <ruf@rawip.org>
        Strange syntax error tseitlin@gmail.com
    Re: What is a type error? <david.nospam.hopwood@blueyonder.co.uk>
    Re: What is a type error? <david.nospam.hopwood@blueyonder.co.uk>
    Re: What is a type error? <jurgenex@hotmail.com>
    Re: What is a type error? <cdsmith@twu.net>
    Re: What is a type error? <david.nospam.hopwood@blueyonder.co.uk>
    Re: What is a type error? <david.nospam.hopwood@blueyonder.co.uk>
    Re: What is a type error? <marshall.spight@gmail.com>
    Re: What is a type error? <cdsmith@twu.net>
    Re: What is a type error? <marshall.spight@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 11 Jul 2006 04:42:08 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Jul 11 2006
Message-Id: <J282E8.1rAE@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.

Acme-DonMartin-0.07
http://search.cpan.org/~dland/Acme-DonMartin-0.07/
For programs that are easy to dictate over the telephone
----
Acme-MetaSyntactic-0.82
http://search.cpan.org/~book/Acme-MetaSyntactic-0.82/
Themed metasyntactic variables names
----
Apache-Session-Wrapper-0.30
http://search.cpan.org/~drolsky/Apache-Session-Wrapper-0.30/
A simple wrapper around Apache::Session
----
CGI-Ex-2.04
http://search.cpan.org/~rhandom/CGI-Ex-2.04/
CGI utility suite - makes powerful application writing fun and easy
----
Data-Bind-0.27
http://search.cpan.org/~clkao/Data-Bind-0.27/
Bind and alias variables
----
Data-FormValidator-4.30
http://search.cpan.org/~markstos/Data-FormValidator-4.30/
Validates user input (usually from an HTML form) based on input profile.
----
DateTime-Format-Pg-0.13
http://search.cpan.org/~dmaki/DateTime-Format-Pg-0.13/
Parse and format PostgreSQL dates and times
----
Deco-0.08
http://search.cpan.org/~narked/Deco-0.08/
Module for simulating body tissue during a scuba dive
----
Devel-DumpSizes-0.01
http://search.cpan.org/~cgautam/Devel-DumpSizes-0.01/
Dump the name and size in bytes (in increasing order) of variables that are available at a give point in a script.
----
Device-USB-0.14
http://search.cpan.org/~gwadej/Device-USB-0.14/
Use libusb to access USB devices.
----
File-ReadSimple.1.1
http://search.cpan.org/~nharale/File-ReadSimple.1.1/
Perl extension for making filehandling very easy for not-so good Perl Programmers.
----
File-StatCache-0.01
http://search.cpan.org/~pevans/File-StatCache-0.01/
a caching wrapper around the stat() function
----
Finance-Quote-1.12
http://search.cpan.org/~hampton/Finance-Quote-1.12/
Get stock and mutual fund quotes from various exchanges
----
Geo-Postcodes-0.01
http://search.cpan.org/~arne/Geo-Postcodes-0.01/
Base class for the Geo::Postcodes::XX modules
----
Geo-Postcodes-DK-0.01
http://search.cpan.org/~arne/Geo-Postcodes-DK-0.01/
Danish postal codes with names
----
Geo-Postcodes-NO-0.01
http://search.cpan.org/~arne/Geo-Postcodes-NO-0.01/
----
Geo-ReadGRIB-0.6
http://search.cpan.org/~frankcox/Geo-ReadGRIB-0.6/
Perl extension that gives read access to GRIB "GRIdded Binary" format Weather data files.
----
HTML-Parser-3.55
http://search.cpan.org/~gaas/HTML-Parser-3.55/
HTML parser class
----
Handel-0.99_03
http://search.cpan.org/~claco/Handel-0.99_03/
Simple commerce framework with AxKit/TT/Catalyst support
----
Image-Thumbnail-0.62
http://search.cpan.org/~lgoddard/Image-Thumbnail-0.62/
Simple thumbnails with GD/ImageMagick/Imager
----
Mac-PropertyList-SAX-0.04
http://search.cpan.org/~kulp/Mac-PropertyList-SAX-0.04/
work with Mac plists at a low level (with real XML parsers)
----
Net-OpenVPN-Manage-0.02
http://search.cpan.org/~meyeaard/Net-OpenVPN-Manage-0.02/
Manage an OpenVPN process via it's management port
----
Net-RBLClient-0.5
http://search.cpan.org/~ablum/Net-RBLClient-0.5/
Queries multiple Realtime Blackhole Lists in parallel
----
Perl-Dist-0.000002
http://search.cpan.org/~dagolden/Perl-Dist-0.000002/
Create binary Perl distributions
----
Pugs-Compiler-Rule-0.10
http://search.cpan.org/~fglock/Pugs-Compiler-Rule-0.10/
Compiler for Perl 6 Rules
----
RDF-Helper-0.31
http://search.cpan.org/~khampton/RDF-Helper-0.31/
Provide a consistent, Perlish interface to Perl's varous RDF processing tools.
----
RDF-Query-1.038
http://search.cpan.org/~gwilliams/RDF-Query-1.038/
An RDF query implementation of SPARQL/RDQL in Perl for use with RDF::Redland and RDF::Core.
----
REST-Application-0.92
http://search.cpan.org/~moconnor/REST-Application-0.92/
A framework for building RESTful web-applications.
----
REST-Application-0.93
http://search.cpan.org/~moconnor/REST-Application-0.93/
A framework for building RESTful web-applications.
----
SNMP-Info-1.04
http://search.cpan.org/~emiller/SNMP-Info-1.04/
Object Oriented Perl5 Interface to Network devices and MIBs through SNMP.
----
SVG2
http://search.cpan.org/~doctormo/SVG2/
----
Socket-Multicast-0.01
http://search.cpan.org/~hachi/Socket-Multicast-0.01/
Constructors and constants for multicast socket operations.
----
Sub-Multi-0.001_2
http://search.cpan.org/~clkao/Sub-Multi-0.001_2/
Data::Bind-based multi-sub dispatch
----
Text-Aspell-0.06
http://search.cpan.org/~hank/Text-Aspell-0.06/
Perl interface to the GNU Aspell library
----
WWW-CheckPad-0.035
http://search.cpan.org/~takeshige/WWW-CheckPad-0.035/
An API to control the check*pad (http://www.checkpad.jp/)
----
WWW-RobotRules-Parser-0.03
http://search.cpan.org/~dmaki/WWW-RobotRules-Parser-0.03/
Just Parse robots.txt
----
XML-Liberal-0.13
http://search.cpan.org/~miyagawa/XML-Liberal-0.13/
Super liberal XML parser that parses broken XML
----
XML2
http://search.cpan.org/~doctormo/XML2/
----
file-statcache-0.01
http://search.cpan.org/~pevans/file-statcache-0.01/
----
threads-1.35
http://search.cpan.org/~jdhedden/threads-1.35/
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: 10 Jul 2006 20:07:28 -0700
From: himanshu.garg@gmail.com
Subject: perltoot bug?
Message-Id: <1152587248.432078.320540@h48g2000cwc.googlegroups.com>

Hello,

      In the aggregation section of perltoot Person.pm does not use
Fullname. As a result of which running the test script given there.

E:\himanshu\ooperl>perl aggregation-test.pl
Can't locate object method "new" via package "Fullname" (perhaps you
forgot to l
oad "Fullname"?) at Person.pm line 13.
All persons are going away now.

      However by adding 'use Fullname;' to Person.pm I get the
following expected output:-

E:\himanshu\ooperl>perl perltoot2.pl
Tommy is really St Thomas Aquinas
Tommy's age: 1.
Tommy's age: 2.
Destroying Person=HASH(0x2252d0) Tommy at perltoot2.pl line 0
All persons are going away now.

      Is this a doc bug.

Thank You,
Himanshu.



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

Date: 10 Jul 2006 22:26:45 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: processing large numbers/values/figures
Message-Id: <slrneb5l15.c2.abigail@alexandra.abigail.nl>

Lukas Ruf (ruf@rawip.org) wrote on MMMMDCXCVI September MCMXCIII in
<URL:news:slrneb55hc.kbb.ruf@pc-4082.ethz.ch>:
<>  Dear all,
<>  
<>  for a large number of files, I must accumulate numbers found
<>  therein.  For this accumulation, I have been running into
<>  number-overruns.
<>  
<>  As a beginner with Perl, I have been able to 'split()' lines
<>  into arrays of numeric-strings.  However, when adding fields
<>  together, number-overruns do happen.
<>  
<>  After searching the web for a while (maybe with the wrong
<>  keywords) without success, I kindly ask this mailing list
<>  for help:
<>  
<>      How can I deal with large numbers in Perl?
<>  
<>          - adding
<>          - subtracting
<>          - multiplying
<>          - dividing
<>          - printing
<>  
<>     + large in the range up to 10*2^^40 (10 Tera).
<>     + most important: adding and printing to ASCII


A Perl using 32-bit integers will automatically convert integers to
floats. If you're dealing with numbers up to about 2**53, there shouldn't
be any loss of precision.

Alternatively, you can compile (or download) a Perl that supports 64-bit
integers.

Or you can pipe your calculations into bc or dc (there's even Inline::BC).

Or use one of the many modules that will help: Math::BigInt, Math::BigFloat,
etc.


Abigail
-- 
#!/opt/perl/bin/perl -w
$\ = $"; $; = $$; END {$: and print $:} $SIG {TERM} = sub {$ := $_}; kill 15 =>
fork and ($; == getppid and exit or wait) foreach qw /Just another Perl Hacker/


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

Date: 11 Jul 2006 08:28:18 +0100
From: Lukas Ruf <ruf@rawip.org>
Subject: Re: processing large numbers/values/figures
Message-Id: <slrneb6h82.34l.ruf@pc-4082.ethz.ch>

> xhoster@gmail.com [10 Jul 2006 20:21:24 GMT]:
>
>  Lukas Ruf <ruf@rawip.org> wrote:
> > Dear all,
> >
> > for a large number of files, I must accumulate numbers found
> > therein.  For this accumulation, I have been running into
> > number-overruns.
>
>  I don't get overruns until 10**307.  Are you sure it is an overrun
>  rather than just a loss of precision?
>

my problem is, after a certain value, it turns to -1.

> >    + large in the range up to 10*2^^40 (10 Tera).
>
>  On my 32 bit machine, I get unit-level precision up to over 1000*2**40.
>

thanks for checking.

> >    + most important: adding and printing to ASCII
>
>  Aside from the bignum and other modules previously mentioned, have you
>  looked at using printf with a higher precision format?  Maybe you are
>  losing precision at the print stage rather than the internal
>  representation.
>

I make use of Perl's hashes

        my %hsh = ();

        $hsh{$key} += @record{$index};

        printf("%15d should be in the range up to 2**34\n",
            $hsh{$key});


Any hint what goes wrong?

Thanks in advance.

wbr,
Lukas
-- 
Lukas Ruf   <http://www.lpr.ch> | Ad Personam
rbacs      <http://wiki.lpr.ch> | Restaurants, Bars and Clubs
Raw IP   <http://www.rawip.org> | Low Level Network Programming
<http://lists.lpr.ch/muttprint> | muttprint mailing list


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

Date: 11 Jul 2006 08:30:11 +0100
From: Lukas Ruf <ruf@rawip.org>
Subject: Re: processing large numbers/values/figures
Message-Id: <slrneb6hbk.34l.ruf@pc-4082.ethz.ch>

> Abigail [10 Jul 2006 22:26:45 GMT]:
>

thanks for answering,

>  Lukas Ruf (ruf@rawip.org) wrote on MMMMDCXCVI September MCMXCIII in
> <URL:news:slrneb55hc.kbb.ruf@pc-4082.ethz.ch>:

>
>  A Perl using 32-bit integers will automatically convert integers to
>  floats. If you're dealing with numbers up to about 2**53, there shouldn't
>  be any loss of precision.
>

weird, why do I still get '-1' even when using 'bignum'?

wbr,
Lukas
-- 
Lukas Ruf   <http://www.lpr.ch> | Ad Personam
rbacs      <http://wiki.lpr.ch> | Restaurants, Bars and Clubs
Raw IP   <http://www.rawip.org> | Low Level Network Programming
<http://lists.lpr.ch/muttprint> | muttprint mailing list


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

Date: 10 Jul 2006 23:07:04 -0700
From: tseitlin@gmail.com
Subject: Strange syntax error
Message-Id: <1152598023.945232.316540@s13g2000cwa.googlegroups.com>

Hello,
I get a syntax error I can't explain.

The script (reduced version):

###############################
use Switch;

my $line;
if ($line =~ /^Frequency\s+=\s+(\d+)\./){
	$freq = $1/1000000;
}

#sub for opening files in 'read', 'write' or 'append' mode
sub openFile()
{
	my ($file, $mode) = @_;
	local *FH;
	switch($mode){
		case 'r'{
			if(!open(FH , $file)){
				print"can't open $file $!";
			return 0;
				}
			}
		case 'w'{
			if(!open(FH , ">$file")){
				print"can't open $file $!";
			return 0;
				}
			}
		case 'a'{
			if(!open(FH , ">>$file")){
				print"can't open $file $!";
			return 0;
				}
			}
		else{
			print"wrong or unsupported mode: use 'r' or 'w'";
			return 0;
		}
	}
	return *FH;
}

# sub simple_stats {
    # my $mean  = $sum_x / $size;
# }

###END########

The error message:
>perl -c test.pl
String found where operator expected at test.pl line 14, near "case
'r'"
        (Do you need to predeclare case?)
syntax error at test.pl line 13, near "){"
syntax error at test.pl line 19, near "}"
test.pl had compilation errors.

Eny of the following eliminates the error:
1. Removing or commenting :
    if ($line =~ /^Frequency\s+=\s+(\d+)\./){
	$freq = $1/1000000;
    }
2. Removing or commenting the openFile sub.
3. Removing the commented simple_stats sub !!!

If any one has an idea, please help! 
Thanks.



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

Date: Tue, 11 Jul 2006 01:14:55 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is a type error?
Message-Id: <jYCsg.74231$7Z6.56831@fe2.news.blueyonder.co.uk>

Chris Smith wrote:
> I <cdsmith@twu.net> wrote:
> 
>>Incidentally, I'm not saying that such a feature would be a good idea.

I don't think it would be a bad idea. Silently giving incorrect results
on arithmetic overflow, as C-family languages do, is certainly a bad idea.
A type system that supported range type arithmetic as you've described would
have considerable advantages, especially in areas such as safety-critical
software. It would be a possible improvement to Ada, which UUIC currently
has a more restrictive range typing system that cannot infer different
ranges for a variable at different points in the program.

I find that regardless of programming language, relatively few of my
integer variables are dimensionless -- most are associated with some
specific unit. Currently, I find variable naming conventions helpful in
documenting this, but the result is probably more verbose than it would
be to drop this information from the names, and instead use more
precise types that indicate the unit and the range.

When prototyping, you could alias all of these to bignum types (with
range [0..+infinity) or (-infinity..+infinity)) to avoid needing to deal
with any type errors, and then constrain them where necessary later.

>>It generally isn't provided in languages specifically because it gets to 
>>be a big pain to maintain all of the type specifications for this kind 
>>of stuff.

It would take a little more work to write a program, but it would be no
more difficult to read (easier if you're also trying to verify its correctness).
Ease of reading programs is more important than writing.

> There are other good reasons, too, as it turns out.  I don't want to 
> overstate the "possible" until it starts to sound like "easy, even if 
> it's a pain".  This kind of stuff is rarely done in mainstream 
> programming languages because it has serious negative consequences.
> 
> For example, I wrote that example using variables of type int.  If we 
> were to suppose that we were actually working with variables of type 
> Person, then things get a little more complicated.  We would need a few 
> (infinite classes of) derived subtypes of Person that further constrain 
> the possible values for state.  For example, we'd need types like:
> 
>     Person{age:{18..29}}
> 
> But this starts to look bad, because we used to have this nice property 
> called encapsulation.

I think you're assuming that 'age' would have to refer to a concrete field.
If it refers to a type parameter, something like:

  class Person{age:Age} is
     Age getAge()
  end

then I don't see how this breaks encapsulation.

-- 
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>


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

Date: Tue, 11 Jul 2006 01:25:15 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is a type error?
Message-Id: <%5Dsg.74232$7Z6.25253@fe2.news.blueyonder.co.uk>

Chris Smith wrote:
> At the same time, though, maybe I do want 
> the compiler to infer that tax cannot be negative (or maybe it can; I'm 
> not an accountant; I know my tax has never been negative), [...]

Tax can be negative, e.g. when a business is claiming back VAT (sales tax)
on its purchases, but the things it is selling have lower-rated or zero
VAT (or it is making a loss).

> Note that even without encapsulation, the kind of typing information 
> we're looking at can be very non-trivial in an imperative language.  For 
> example, I may need to express a method signature that is kind of like 
> this:
> 
> 1. The first parameter is an int, which is either between 4 and 8, or 
> between 11 and 17.
> 
> 2. The second parameter is a pointer to an object, whose 'foo' field is 
> an int between 0 and 5, and whose 'bar' field is a pointer to another 
> object with three fields 'a', 'b', and 'c', each of which has the full 
> range of an unconstrained IEEE double precision floating point number.
> 
> 3. After the method returns, it will be known that if this object 
> previously had its 'baz' field in the range m .. n, it is now in the 
> range (m - 5) .. (n + 1).
> 
> 4. After the method returns, it will be known that the object reached by 
> following the 'bar' field of the second parameter will be modified so 
> that the first two of its floating point numbers are guaranteed to be of 
> the opposite sign as they were before, and that if they were infinity, 
> they are now finite.
> 
> 5. After the method returns, the object referred to by the global 
> variable 'zab' has 0 as the value of its 'c' field.
> 
> Just expressing all of that in a method signature looks interesting 
> enough.  If we start adding abstraction to the type constraints on 
> objects to support encapsulation (as I think you'd have to do), then 
> things get even more interesting.

1 and 2 are easy enough. 3 to 5 are best expressed as assertions rather
than types.

-- 
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>


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

Date: Tue, 11 Jul 2006 01:44:30 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: What is a type error?
Message-Id: <2oDsg.14592$Wh7.11783@trnddc07>

David Hopwood wrote:
[...]

There is no such error message listed in 'perldoc perldiag'.
Please quote the actual text of your error message and include the program 
that produced this error.
Then people here in CLPM may be able to assist you.

jue 




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

Date: Mon, 10 Jul 2006 19:49:11 -0600
From: Chris Smith <cdsmith@twu.net>
Subject: Re: What is a type error?
Message-Id: <MPG.1f1cb1655d051e6f98977f@news.altopia.net>

David Hopwood <david.nospam.hopwood@blueyonder.co.uk> wrote:
> 1 and 2 are easy enough. 3 to 5 are best expressed as assertions rather
> than types.

One of us is missing the other's meaning here.  If 3 to 5 were expressed 
as assertions rather than types, then the type system would become 
incomplete, requiring frequent runtime-checked type ascriptions to 
prevent it from becoming impossible to write software.  That's not my 
idea of a usable language.

-- 
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation


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

Date: Tue, 11 Jul 2006 02:10:40 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is a type error?
Message-Id: <AMDsg.307637$8W1.193192@fe1.news.blueyonder.co.uk>

Chris Smith wrote:
> David Hopwood <david.nospam.hopwood@blueyonder.co.uk> wrote:
> 
>>1 and 2 are easy enough. 3 to 5 are best expressed as assertions rather
>>than types.
> 
> One of us is missing the other's meaning here.  If 3 to 5 were expressed 
> as assertions rather than types, then the type system would become 
> incomplete, requiring frequent runtime-checked type ascriptions to 
> prevent it from becoming impossible to write software.  That's not my 
> idea of a usable language.

Maybe I'm not understanding what you mean by "complete". Of course any
type system of this expressive power will be incomplete (whether or not
it can express conditions 3 to 5), in the sense that it cannot prove all
true assertions about the types of expressions.

So yes, some assertions would need to be checked at runtime (others could be
proven to always hold by a theorem prover).

Why is this a problem? The goal is not to check everything at compile time;
the goal is just to support writing correct programs.

-- 
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>


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

Date: Tue, 11 Jul 2006 02:16:02 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is a type error?
Message-Id: <CRDsg.56590$181.46496@fe3.news.blueyonder.co.uk>

J=FCrgen Exner wrote:
> David Hopwood wrote:
> [...]
>=20
> There is no such error message listed in 'perldoc perldiag'.
> Please quote the actual text of your error message and include the prog=
ram=20
> that produced this error.
> Then people here in CLPM may be able to assist you.

Yes, I'm well aware that most of this thread has been off-topic for c.l.p=
=2Em,
but it is no less off-topic for the other groups (except possibly c.l.fun=
ctional),
and I can't trim the Newsgroups line down to nothing.

Don't you have a newsreader that can mark whole threads that you don't wa=
nt
to read?

--=20
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>


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

Date: 10 Jul 2006 21:02:35 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is a type error?
Message-Id: <1152590555.413435.40270@s13g2000cwa.googlegroups.com>

David Hopwood wrote:
> J=FCrgen Exner wrote:
> > David Hopwood wrote:
> > [...]
> >
> > There is no such error message listed in 'perldoc perldiag'.
> > Please quote the actual text of your error message and include the prog=
ram
> > that produced this error.
> > Then people here in CLPM may be able to assist you.
>
> Yes, I'm well aware that most of this thread has been off-topic for c.l.p=
 .m,
> but it is no less off-topic for the other groups (except possibly c.l.fun=
ctional),
> and I can't trim the Newsgroups line down to nothing.
>
> Don't you have a newsreader that can mark whole threads that you don't wa=
nt
> to read?

Sure, or he could just skip over it. Or he could make a simple
request, such as "please trim comp.lang.whatever because it's
off-topic here." But he hasn't done any of these, choosing instead
to drop in with his occasional pointless snarky comments.


Marshall



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

Date: Mon, 10 Jul 2006 22:05:33 -0600
From: Chris Smith <cdsmith@twu.net>
Subject: Re: What is a type error?
Message-Id: <MPG.1f1cd16c26f92e6d989781@news.altopia.net>

David Hopwood <david.nospam.hopwood@blueyonder.co.uk> wrote:
> Maybe I'm not understanding what you mean by "complete". Of course any
> type system of this expressive power will be incomplete (whether or not
> it can express conditions 3 to 5), in the sense that it cannot prove all
> true assertions about the types of expressions.

Ah.  I meant complete enough to accomplish the goal in this subthread, 
which was to ensure that the compiler knows when a particular int 
variable is guaranteed to be greater than 18, and when it is not.

-- 
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation


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

Date: 10 Jul 2006 22:55:40 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is a type error?
Message-Id: <1152597340.855103.153510@b28g2000cwb.googlegroups.com>

Joachim Durchholz wrote:
> Marshall schrieb:
> > Joachim Durchholz wrote:
> >> Chris Smith schrieb:
> >>> For example, I wrote that example using variables of type int.  If we
> >>> were to suppose that we were actually working with variables of type
> >>> Person, then things get a little more complicated.  We would need a few
> >>> (infinite classes of) derived subtypes of Person that further constrain
> >>> the possible values for state.  For example, we'd need types like:
> >>>
> >>>     Person{age:{18..29}}
> >>>
> >>> But this starts to look bad, because we used to have this nice
> >>> property called encapsulation.  To work around that, we'd need to
> >>> make one of a few choices: [...] (c) invent some kind of generic
> >>> constraint language so that constraints like this could be expressed
> >>> without exposing field names. [...] Choice (c), though, looks a
> >>> little daunting.
> >> That's not too difficult.
> >> Start with boolean expressions.
> >> If you need to check everything statically, add enough constraints that
> >> they become decidable.
> >
> > I'm not sure I understand. Could you elaborate?
>
> Preconditions/postconditions can express anything you want, and they are
> an absolutely natural extensions of what's commonly called a type
> (actually the more powerful type systems have quite a broad overlap with
> assertions).
> I'd essentially want to have an assertion language, with primitives for
> type expressions.

Now, I'm not fully up to speed on DBC. The contract specifications,
these are specified statically, but checked dynamically, is that
right? In other words, we can consider contracts in light of
inheritance, but the actual verification and checking happens
at runtime, yes?

Wouldn't it be possible to do them at compile time? (Although
this raises decidability issues.) Mightn't it also be possible to
leave it up to the programmer whether a given contract
was compile-time or runtime?

I've been wondering about this for a while.


Marshall



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

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


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