[28030] in Perl-Users-Digest
Perl-Users Digest, Issue: 9394 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 27 18:05:45 2006
Date: Tue, 27 Jun 2006 15:05:07 -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, 27 Jun 2006 Volume: 10 Number: 9394
Today's topics:
crash on fork in taint mode <ynleder@nspark.org>
Re: crash on fork in taint mode <nobull67@gmail.com>
Re: Escaping escape characters in variables (in regexs) <benmorrow@tiscali.co.uk>
Re: Escaping escape characters in variables (in regexs) <David.Squire@no.spam.from.here.au>
Re: how to remote a unix server in my cgi script <glennj@ncf.ca>
Re: languages with full unicode support <find@my.address.elsewhere>
Re: List context versus list context <ced@blv-sam-01.ca.boeing.com>
Re: List context versus list context <tadmc@augustmail.com>
Re: Parsing data file, need help with the logic guser@packetstorm.org
Re: Parsing data file, need help with the logic guser@packetstorm.org
Re: Parsing data file, need help with the logic <glennj@ncf.ca>
Re: Parsing data file, need help with the logic <tadmc@augustmail.com>
Re: Parsing data file, need help with the logic <tadmc@augustmail.com>
Re: Running another program in daemon server <tzz@lifelogs.com>
Re: Searching each element of an array with grep <1usa@llenroc.ude.invalid>
Re: Test loop <tzz@lifelogs.com>
Re: What is a type error? <pc@p-cos.net>
Re: What is a type error? <pc@p-cos.net>
Re: What is Expressiveness in a Computer Language [corr <david.nospam.hopwood@blueyonder.co.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Jun 2006 20:52:21 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: crash on fork in taint mode
Message-Id: <MPG.1f0b9cd14bbc05a39898ab@news.tiscali.fr>
Hello. I'm using ActivePerl 5.8.8 build 817 and Apache2 for Windows. The
script below crashes on fork() when I run it in taint mode (not if I
remove -T).
#!/usr/bin/perl -wT
print "Content-type: text/html\n\n";
my $pid = fork();
die "can't fork: $!\n" unless defined $pid;
if (!$pid){print "<p>child in progress...</p>"; exit 0;}
print "<p>parent in progress...</p>";
exit 0;
I don't even get the "can't fork" error message, the script crashes on
the line above with a raw perl.exe exception.
Did you seen something like this ?
------------------------------
Date: 27 Jun 2006 14:17:50 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: crash on fork in taint mode
Message-Id: <1151443070.093979.120750@y41g2000cwy.googlegroups.com>
Yohan N. Leder wrote:
> Hello. I'm using ActivePerl 5.8.8 build 817 and Apache2 for Windows. The
> script below crashes on fork() when I run it in taint mode (not if I
> remove -T).
> Did you seen something like this ?
Yes,
http://groups.google.com/groups/search?q=fork+taint
------------------------------
Date: Tue, 27 Jun 2006 16:45:21 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Escaping escape characters in variables (in regexs)
Message-Id: <hd08n3-1l8.ln1@osiris.mauzo.dyndns.org>
Quoth Ben Morrow <benmorrow@tiscali.co.uk>:
>
> Quoth David Squire <David.Squire@no.spam.from.here.au>:
> > johnnykimble@gmail.com wrote:
> > > For example, say I have a file containing the following:
> > >
> > > <SomeNode>skdsSda3321/2=///==asda==////adasd/213/dw/ASDASd/ad</SomeNode>
> > >
> > > I can pull out the Base64 here with:
<snip>
> >
> > perldoc perlfunc
> >
> > - search for quotemeta.
>
> ...except none of the characters in Base64 are meta.
Sorry, of course '+' is meta and in Base64... what I meant was, 'None of
the characters in the above piece of Base64 are meta, so presuming this
is the OP's real code that's not the problem'.
Ben
--
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks] benmorrow@tiscali.co.uk
------------------------------
Date: Tue, 27 Jun 2006 21:36:49 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Escaping escape characters in variables (in regexs)
Message-Id: <e7s4t1$f9u$1@news.ox.ac.uk>
Ben Morrow wrote:
> Quoth Ben Morrow <benmorrow@tiscali.co.uk>:
>> Quoth David Squire <David.Squire@no.spam.from.here.au>:
>>> johnnykimble@gmail.com wrote:
>>>> For example, say I have a file containing the following:
>>>>
>>>> <SomeNode>skdsSda3321/2=///==asda==////adasd/213/dw/ASDASd/ad</SomeNode>
>>>>
>>>> I can pull out the Base64 here with:
> <snip>
>>> perldoc perlfunc
>>>
>>> - search for quotemeta.
>> ...except none of the characters in Base64 are meta.
>
> Sorry, of course '+' is meta and in Base64... what I meant was, 'None of
> the characters in the above piece of Base64 are meta, so presuming this
> is the OP's real code that's not the problem'.
... and indeed Base64 is not uniquely defined - the last few characters
beyond 0-9, A-Z, a-z differ in various conventions - though now the
version in the MIME RFC seems to be the de facto standard.
DS
------------------------------
Date: 27 Jun 2006 18:09:08 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: how to remote a unix server in my cgi script
Message-Id: <slrnea2t24.ee4.glennj@smeagol.ncf.ca>
At 2006-06-27 10:17AM, debbie523 <Deb.Fang@gmail.com> wrote:
> I have a cgi script stay in one unix server A, and in this cgi script I
> have to call a program which sits on another unix server B. so there
> should have server lines to login B in my cgi script. Is there somebody
> help me figure out what's the specific command I should use.
If the program on server B does not run in a CGI environment, you may
want to investigate Expect.
--
Glenn Jackman
Ulterior Designer
------------------------------
Date: Tue, 27 Jun 2006 15:54:02 -0500
From: Matthias Blume <find@my.address.elsewhere>
Subject: Re: languages with full unicode support
Message-Id: <m164iml3px.fsf@hana.uchicago.edu>
Tin Gherdanarra <tinman31337@gmail.com> writes:
> Oliver Bandel wrote:
>> こんいちわ Xah-Lee san ;-)
>
> Uhm, I'd guess that Xah is Chinese. Be careful
> with such things in real life; Koreans might
> beat you up for this. Stay alive!
And the Japanese might beat him up, too. For butchering their
language. :-)
------------------------------
Date: Tue, 27 Jun 2006 19:58:00 GMT
From: Charles DeRykus <ced@blv-sam-01.ca.boeing.com>
Subject: Re: List context versus list context
Message-Id: <J1JBGn.1vx@news.boeing.com>
xhoster@gmail.com wrote:
> Ch Lamprecht <christoph.lamprecht.no.spam@web.de> wrote:
>> Tad McClellan wrote:
>...
>
> It is starting to look like a bug.
> ...
>
> A slice off the end of a nonempty list is an empty list in an assignment,
> but not as the arg to a sub.
>
The "off-the-end" semantics in the 2 assignment examples below looks
unexpected to me too.
I can see that the 2nd example becomes a non-empty list but why should
it generate the additional undef's while the 1st example remains mired
in its own emptiness...:)
$ perl -MData::Dumper -le 'my @x = (0)[2,4,6]; print Dumper \@x'
$VAR1 = [];
$ perl -MData::Dumper -le 'my @x = (0)[0, 2,4,6];print Dumper \@x'
$VAR1 = [
0,
undef,
undef,
undef
];
--
Charles DeRykus
------------------------------
Date: Tue, 27 Jun 2006 16:36:51 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: List context versus list context
Message-Id: <slrnea397j.rvh.tadmc@magna.augustmail.com>
Charles DeRykus <ced@blv-sam-01.ca.boeing.com> wrote:
> xhoster@gmail.com wrote:
>> Ch Lamprecht <christoph.lamprecht.no.spam@web.de> wrote:
>>> Tad McClellan wrote:
>>...
>>
>> It is starting to look like a bug.
>> ...
>>
>> A slice off the end of a nonempty list is an empty list in an assignment,
>> but not as the arg to a sub.
>>
>
> The "off-the-end" semantics in the 2 assignment examples below looks
> unexpected to me too.
>
> I can see that the 2nd example becomes a non-empty list but why should
> it generate the additional undef's
It doesn't generate any "additional" undefs, 4 indexes, 4 values.
> while the 1st example remains mired
> in its own emptiness...:)
Because when it is _all_ undefs (ie. _all_ of the indexes are off
the end), the special case of returning an empty list kicks in.
perldata says
This makes it easy to write loops that terminate when a null list
is returned
as a "justification" for this behavior.
> $ perl -MData::Dumper -le 'my @x = (0)[2,4,6]; print Dumper \@x'
> $VAR1 = [];
>
> $ perl -MData::Dumper -le 'my @x = (0)[0, 2,4,6];print Dumper \@x'
> $VAR1 = [
> 0,
> undef,
> undef,
> undef
> ];
Neither of these display the bug that is under discussion.
The 1st one generates the empty list rather than the non-empty list
that the bug gives.
The 2nd one is not _all_ off of the end, so a non-empty list is expected.
The bug is when all of the indexes are off the end and it returns
a non-empty list.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 27 Jun 2006 12:44:50 -0700
From: guser@packetstorm.org
Subject: Re: Parsing data file, need help with the logic
Message-Id: <1151437490.319021.76540@b68g2000cwa.googlegroups.com>
dh wrote:
> Hi,
> try the following:
> while (<>){
> ($hostname)= /.+:(.*)/ if (/Host Name/);
> ($primdnssuf)= /.+:(.*)/ if (/Primary Dns Suffix/);
> ($mediastate)= /.+:(.*)/ if (/Media State/);
> ($physaddress)= /.+:(.*)/ if (/Physical Address/);
> ($ipaddress)= /.+:(.*)/ if (/IP Address/);
> };
>
> Daniel
>
thanks, thats alot cleaner than what I was doing but did not address
(or I am missing the clue) what to do with multiple adapter records in
the same file.
As long as the while loop is true and if a file has say 3 network
adapter entries, the variables for the adapter parts will get
overwritten. Or worse, if the local adapter is first and a vpn adapter
is next, the above could overwrite the physaddress with the vpn adapter
mac.
------------------------------
Date: 27 Jun 2006 13:06:39 -0700
From: guser@packetstorm.org
Subject: Re: Parsing data file, need help with the logic
Message-Id: <1151438799.622845.86210@y41g2000cwy.googlegroups.com>
ah i got it now, something like this
while (<FILE>) {
($hostname) = /.+:(.*)/ if (/Host Name/);
($primdnssuf) = /.+:(.*)/ if (/Primary Dns Suffix/);
($mediastate) = /.+:(.*)/ if (/Media State/);
($physaddress)= /.+:(.*)/ if (/Physical Address/);
($ipaddress) = /.+:(.*)/ if (/IP Address/);
($description) = /.+:(.*)/ if (/Description/);
if ($mediastate ne '') { push (@mediastate,$mediastate); }
if ($physaddress ne '') { push (@physaddress,$physaddress); }
if ($description ne '') { push (@description,$description); }
$hostname = '';
$primdnssuf = '';
$mediastate = '';
$physaddress = '';
$description = '';
}
then i get the physaddress array size and use that to loop for each
adapter array entry I stored.
------------------------------
Date: 27 Jun 2006 20:26:28 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Parsing data file, need help with the logic
Message-Id: <slrnea353k.ee4.glennj@smeagol.ncf.ca>
At 2006-06-27 04:06PM, guser@packetstorm.org <guser@packetstorm.org> wrote:
> ah i got it now, something like this
>
> while (<FILE>) {
> ($hostname) = /.+:(.*)/ if (/Host Name/);
> ($primdnssuf) = /.+:(.*)/ if (/Primary Dns Suffix/);
> ($mediastate) = /.+:(.*)/ if (/Media State/);
> ($physaddress)= /.+:(.*)/ if (/Physical Address/);
> ($ipaddress) = /.+:(.*)/ if (/IP Address/);
> ($description) = /.+:(.*)/ if (/Description/);
>
>
>
> if ($mediastate ne '') { push (@mediastate,$mediastate); }
> if ($physaddress ne '') { push (@physaddress,$physaddress); }
> if ($description ne '') { push (@description,$description); }
>
> $hostname = '';
> $primdnssuf = '';
> $mediastate = '';
> $physaddress = '';
> $description = '';
> }
Or:
while (<FILE>) {
my ($hostname, $primdnssuf, $mediastate, $physaddress,
$ipaddress, $description);
# don't need to perform 2 regex matches per line
if (/Host Name.+:(.*)/) { $hostname = $1; }
if (/Primary Dns Suffix.+:(.*)/) { $primdnssuf = $1; }
if (/IP Address.+:(.*)/) { $ipaddress = $1; }
if (/Media State.+:(.*)/) {
$mediastate = $1;
push @mediastate, $mediastate;
}
if (/Physical Address.+:(.*)/) {
$physaddress = $1;
push @physaddress, $physaddress;
}
if (/Description.+:(.*)/) {
$description = $1;
push @description, $description;
}
# use of 'my' variables limits their scope to a single
# loop iteration -- no need to explicitly "null" them
}
--
Glenn Jackman
Ulterior Designer
------------------------------
Date: Tue, 27 Jun 2006 16:41:13 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Parsing data file, need help with the logic
Message-Id: <slrnea39fp.rvh.tadmc@magna.augustmail.com>
guser@packetstorm.org <guser@packetstorm.org> wrote:
> if ($mediastate ne '') { push (@mediastate,$mediastate); }
I think that is more nicely written this way:
push @mediastates, $mediastate if length $mediastate;
(Arrays names should be in plural form too.)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 27 Jun 2006 16:45:19 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Parsing data file, need help with the logic
Message-Id: <slrnea39nf.rvh.tadmc@magna.augustmail.com>
Glenn Jackman <glennj@ncf.ca> wrote:
> if (/Media State.+:(.*)/) {
> $mediastate = $1;
> push @mediastate, $mediastate;
> }
No need to copy it to a temporary variable here.
Once you eliminate the unnecessary variable, it is not homely
as a one liner:
push @mediastate, $1 if /Media State.+:(.*)/;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 27 Jun 2006 14:26:21 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Running another program in daemon server
Message-Id: <g69ac7y8ng2.fsf@CN1374059D0130.kendall.corp.akamai.com>
On 23 Jun 2006, tadmc@augustmail.com wrote:
Ted Zlatanov <tzz@lifelogs.com> wrote:
>
>> Generally specify paths for system() with '/' instead of '\' and life
>> will be easier and more portable.
>
>
> But only for the more-than-1-arg form of system().
>
> You cannot use forward slashes with 1-arg system() on
> silly "operating systems". (I think.)
Yes, unfortunately that's passed to the command interpreter which will
do violent things to that purty command line. I try very hard to use
the multi-arg system() call to avoid problems like this (and security
problems!). Thanks for catching that.
Ted
------------------------------
Date: Tue, 27 Jun 2006 19:04:46 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Searching each element of an array with grep
Message-Id: <Xns97EF997E754C0asu1cornelledu@127.0.0.1>
"Dr.Ruud" <rvtol+news@isolution.nl> wrote in news:e7s27g.vs.1
@news.isolution.nl:
> A. Sinan Unur schreef:
>> Dr.Ruud:
>>> KaZ:
>
>>>> I'm trying to find all elements of an array that match a particular
>>>> pattern. So far, I used:
>>>>
>>>> grep { /\t$var\t/ } @array
>>>
>>> ITYM: grep /\t$var\t/, @array
>>
>> C:\DOCUME~1\asu1\LOCALS~1\Temp> perldoc -f grep
>> grep BLOCK LIST
>> grep EXPR,LIST
>>
>> Why do you prefer the second the first form?
>
> Because the block isn't necessary.
It is not wrong, though.
> Because /\t$var\t/ is an expression.
And a block contains zero or more expressions. In the case of a single match
as above, the block form is equivalent to the expression form. There was no
need for your correction.
Sinan
------------------------------
Date: Tue, 27 Jun 2006 14:07:40 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Test loop
Message-Id: <g69mzby8ob7.fsf@CN1374059D0130.kendall.corp.akamai.com>
On 26 Jun 2006, kaz219@gawab.com wrote:
> To be more precise, I want to write a line in a file only if it hasn't
> already been written in it. So I have to scan the lines of the file
> with a foreach loop, and if the line wasn't found, I wrote it in.
# allow multiple lines to be inserted, and assume order doesn't matter
my %newlines = ( 'line 1' => 1, 'line 2' => 1);
open F, "<$file" or die "Couldn't open $file: $!";
while (<F>)
{
chomp;
delete $newlines{$_} if exists $newslines{$_};
}
close F;
open F, ">>$file" or die "Couldn't open $file for appending: $!";
print F "$_\n" foreach keys %newlines;
close F;
> So, actually, I have another question: is it possible to open the file
> only once at the beginning of the script (I'm writing a script), search
> it for a line, append lines, without having to close and reopen it?
> Because opening and closing files a lot of times make the script quite
> slow, as far as I can tell, and I want to process very big files with
> it, so speed matters.
Others have answered this. My advice is to keep it simple - instead
of opening read/write, try to open read-only and then write when you
have the data ready. Of course this is not always true, sometimes you
really need read/write opens and complicated algorithms, but you
should always look for the simple solution first. This is not so much
Occam's razor as common sense: simple solutions are easier to program,
test, and debug.
Ted
------------------------------
Date: Tue, 27 Jun 2006 22:57:34 +0200
From: Pascal Costanza <pc@p-cos.net>
Subject: Re: What is a type error?
Message-Id: <4gdkduF1ldalhU1@individual.net>
Chris Smith wrote:
> Pascal Costanza <pc@p-cos.net> wrote:
>>> Clearly, in this example, the program
>>> is invoking an operation (division) on values that are not appropriate
>>> (zero for the second argument). Hence, if your definition really is a
>>> definition, then this must qualify.
>> Here, you are asking more from dynamic type systems than any existing
>> type system provides. The definition of what is considered to be a type
>> error and what not is always part of the specification of a type system.
>
> No, I'm not. Were we to follow this path of definition, it would not
> require that dynamic type systems catch ALL type errors; only that they
> catch some. Not that it matters, though. I am analyzing the logical
> consequences of your own definition. If those logical consequences were
> impossible to fulfill, that would be an even more convincing reason to
> find a new definition. Concepts of fairness don't enter into the
> equation.
Yes it does. All static type systems define only a strict subset of all
possible errors to be covered, and leave others as runtime errors. The
same holds for dynamic type systems.
>>> If you want to make a statement instead of the sort you've implied
>>> above... namely that a type error is *any* error that's raised by a type
>>> system, then that's fine. It certainly brings us closer to static
>>> types. Now, though, the task is to define a type system without making
>>> a circular reference to types. You've already rejected the statement
>>> that all runtime errors are type errors, because you specifically reject
>>> the division by zero case as a type error for most languages. What is
>>> that distinction?
>> I don't need such a distinction. I can just define what is covered by a
>> type system and what is not. All type systems work that way.
>
> You've got to define something... or, I suppose, just go on using words
> without definitions. You claimed to give a definition, though.
>
> I have been led by others to believe that the right way to go in the
> dynamic type sense is to first define type errors, and then just call
> anything that finds type errors a type system. That would work, but it
> would require a type error. You seem to want to push that work off of
> the word "type error" and back onto "type system", but that requires
> that you define what a type system is.
I didn't know I was supposed to give a definition.
> Incidentally, in the case of static type systems, we define the system
> (for example, using the definition given from Pierce many times this
> thread), and then infer the definition of types and type errors from
> there. Because a solid definition has been given first for a type
> system without invoking the concepts of types or type errors, this
> avoids being circular.
Do you mean this one? "A type system is a tractable syntactic method for
proving the absence of certain program behaviors by classifying phrases
according to the kinds of values they compute." This isn't really such a
strong definition because it shifts the problem of what exactly a type
system is to finding a definition for the word "kind".
But if this makes you happy, here is an attempt:
"A dynamic type system is a tractable syntactic method for proving the
absence of certain program behaviors by classifying values according to
their kinds."
Basically, this correlates with the typical approach of using tags to
indicate the type/kind/class of values. And indeed, this is what dynamic
type systems typically do: they check tags associated with values. Other
kinds of runtime errors are not raised because of such checks, but
because of other reasons. Therefore, there is naturally a distinction
between runtime errors that are type errors and those that are not.
I am not convinced that this definition of mine is a lot clearer than
what I have said before, but I am also not convinced that Pierce's
definition is any clearer either. It is merely a characterization of
what static type systems do.
The preciseness comes into play when actually defining a type system:
then you have to give definitions what the errors at runtime are that
you want to prove absent by way of the static type system, give the
typing rules for the type system, and then prove soundness by showing
that the typing rules correlate precisely to the runtime errors in the
first stage. Since you have to map two different views of the same thing
to each other you have to be precise in giving definitions that you can
then successfully use in your proofs.
In dynamic type system, this level of precision is not necessary because
proving that dynamic type errors is what the dynamic type system catches
is trivially true, and most programmers don't care that there is a
distinction between runtime type errors and runtime "other" errors. But
this doesn't mean that this distinction doesn't exist.
Pascal
--
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
------------------------------
Date: Tue, 27 Jun 2006 22:59:47 +0200
From: Pascal Costanza <pc@p-cos.net>
Subject: Re: What is a type error?
Message-Id: <4gdki2F1ldalhU2@individual.net>
Marshall wrote:
> Pascal Costanza wrote:
>> Consider division by zero: appropriate arguments for division are
>> numbers, including the zero.
>
> A bold assertion!
>
> The general question is, what do we do about partial functions?
>
>
>> The dynamic type check will typically not
>> check whether the second argument is zero, but will count on the fact
>> that the processor will raise an exception one level deeper.
>
> This is an implementation artifact, and hence not relevant to our
> understanding of the issue.
No, it's not. I am pretty sure that you can model this formally.
Pascal
--
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
------------------------------
Date: Tue, 27 Jun 2006 20:38:08 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is Expressiveness in a Computer Language [correction]
Message-Id: <QGgog.485335$xt.416310@fe3.news.blueyonder.co.uk>
David Hopwood wrote:
> Marshall wrote:
>>David Hopwood wrote:
>>>Marshall wrote:
>>>
>>>>The real question is, are there some programs that we
>>>>can't write *at all* in a statically typed language, because
>>>>they'll *never* be typable?
>>>
>>>In a statically typed language that has a "dynamic" type, all
>>>dynamically typed programs are straightforwardly expressible.
Correction: as the paper on gradual typing referenced below points
out in section 5, something like the "typerec" construct of
<http://citeseer.ist.psu.edu/harper95compiling.html> would be
needed, in order for a system with a "dynamic" type to be equivalent
in expressiveness to dynamic typing or gradual typing.
("typerec" can be used to implement "dynamic"; it is more general.)
>>So, how does this "dynamic" type work?
>
> <http://citeseer.ist.psu.edu/abadi89dynamic.html>
>
>>It can't simply be the "any" type, because that type has no/few
>>functions defined on it.
>
> It isn't. From the abstract of the above paper:
>
> [...] even in statically typed languages, there is often the need to
> deal with data whose type cannot be determined at compile time. To handle
> such situations safely, we propose to add a type Dynamic whose values are
> pairs of a value v and a type tag T where v has the type denoted by T.
> Instances of Dynamic are built with an explicit tagging construct and
> inspected with a type safe typecase construct.
>
> "Gradual typing" as described in
> <http://www.cs.rice.edu/~jgs3847/pubs/pubs/2006/siek06:_gradual.pdf> is
> another alternative. The difference between gradual typing and a
> "dynamic" type
This should be: the difference between gradual typing and a system with
"typerec"...
> is one of convenience rather than expressiveness --
> gradual typing does not require explicit tagging and typecase constructs.
--
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
------------------------------
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 9394
***************************************