[27993] in Perl-Users-Digest
Perl-Users Digest, Issue: 9357 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 23 11:10:16 2006
Date: Fri, 23 Jun 2006 08:10: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 Fri, 23 Jun 2006 Volume: 10 Number: 9357
Today's topics:
Re: Saying "latently-typed language" is making a catego <find@my.address.elsewhere>
Re: Saying "latently-typed language" is making a catego <pc@p-cos.net>
Re: Saying "latently-typed language" is making a catego <jurgenex@hotmail.com>
Re: Saying "latently-typed language" is making a catego <pats@acm.org>
Re: Saying "latently-typed language" is making a catego <find@my.address.elsewhere>
Re: Saying "latently-typed language" is making a catego <pc@p-cos.net>
Re: service name package <thepoet_nospam@arcor.de>
Using command line argument as variable name <tiggyboo@gmail.com>
Re: Using command line argument as variable name <mol10metal@hotmail.com>
Re: Using command line argument as variable name <jurgenex@hotmail.com>
Re: Using command line argument as variable name <simon.chao@fmr.com>
Re: Using command line argument as variable name <darksaga_work@yahoo.com>
Re: Using command line argument as variable name <tiggyboo@gmail.com>
Re: Using command line argument as variable name <jurgenex@hotmail.com>
Re: Using command line argument as variable name <tiggyboo@gmail.com>
Re: Using command line argument as variable name <peace.is.our.profession@gmx.de>
Re: What is Expressiveness in a Computer Language <rossberg@ps.uni-sb.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 23 Jun 2006 08:18:09 -0500
From: Matthias Blume <find@my.address.elsewhere>
Subject: Re: Saying "latently-typed language" is making a category mistake
Message-Id: <m2zmg46mem.fsf@hanabi.local>
Pascal Costanza <pc@p-cos.net> writes:
> Patricia Shanahan wrote:
>> Vesa Karvonen wrote:
>> ...
>>> An example of a form of informal reasoning that (practically) every
>>> programmer does daily is termination analysis. There are type systems
>>> that guarantee termination, but I think that is fair to say that it
>>> is not
>>> yet understood how to make a practical general purpose language, whose
>>> type system would guarantee termination (or at least I'm not aware
>>> of such
>>> a language). It should also be clear that termination analysis need not
>>> be done informally. Given a program, it may be possible to
>>> formally prove
>>> that it terminates.
>> To make the halting problem decidable one would have to do one of
>> two
>> things: Depend on memory size limits, or have a language that really is
>> less expressive, at a very deep level, than any of the languages
>> mentioned in the newsgroups header for this message.
>
> Not quite. See http://en.wikipedia.org/wiki/ACL2
What do you mean "not quite"? Of course, Patricia is absolutely
right. Termination-guaranteeing languages are fundamentally less
expressive than Turing-complete languages. ACL2 was not mentioned in
the newsgroup header.
------------------------------
Date: Fri, 23 Jun 2006 15:32:54 +0200
From: Pascal Costanza <pc@p-cos.net>
Subject: Re: Saying "latently-typed language" is making a category mistake
Message-Id: <4g28s6F1k9npnU1@individual.net>
Matthias Blume wrote:
> Pascal Costanza <pc@p-cos.net> writes:
>
>> Patricia Shanahan wrote:
>>> Vesa Karvonen wrote:
>>> ...
>>>> An example of a form of informal reasoning that (practically) every
>>>> programmer does daily is termination analysis. There are type systems
>>>> that guarantee termination, but I think that is fair to say that it
>>>> is not
>>>> yet understood how to make a practical general purpose language, whose
>>>> type system would guarantee termination (or at least I'm not aware
>>>> of such
>>>> a language). It should also be clear that termination analysis need not
>>>> be done informally. Given a program, it may be possible to
>>>> formally prove
>>>> that it terminates.
>>> To make the halting problem decidable one would have to do one of
>>> two
>>> things: Depend on memory size limits, or have a language that really is
>>> less expressive, at a very deep level, than any of the languages
>>> mentioned in the newsgroups header for this message.
>> Not quite. See http://en.wikipedia.org/wiki/ACL2
>
> What do you mean "not quite"? Of course, Patricia is absolutely
> right. Termination-guaranteeing languages are fundamentally less
> expressive than Turing-complete languages. ACL2 was not mentioned in
> the newsgroup header.
ACL2 is a subset of Common Lisp, and programs written in ACL2 are
executable in Common Lisp. comp.lang.lisp is not only about Common Lisp,
but even if it were, ACL2 would fit.
Pascal
--
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
------------------------------
Date: Fri, 23 Jun 2006 13:50:50 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Saying "latently-typed language" is making a category mistake
Message-Id: <_kSmg.983$Wh.149@trnddc04>
Vesa Karvonen wrote:
> In comp.lang.functional Anton van Straaten <anton@appsolutions.com>
> wrote: [...]
>> I reject this comparison. There's much more to it than that. The
>
> I think that we're finally getting to the bottom of things. While
> reading your reponses something became very clear to me:
> latent-typing and latent- types are not a property of languages.
> Latent-typing, also known as informal reasoning, is something that
And what does this have to do with Perl? Are you an alter ego of Xha Lee who
spills his 'wisdom' across any newsgroup he can find?
jue
------------------------------
Date: Fri, 23 Jun 2006 14:08:40 GMT
From: Patricia Shanahan <pats@acm.org>
Subject: Re: Saying "latently-typed language" is making a category mistake
Message-Id: <IBSmg.10811$o4.4857@newsread2.news.pas.earthlink.net>
Pascal Costanza wrote:
> Matthias Blume wrote:
>> Pascal Costanza <pc@p-cos.net> writes:
>>
>>> Patricia Shanahan wrote:
>>>> Vesa Karvonen wrote:
>>>> ...
>>>>> An example of a form of informal reasoning that (practically) every
>>>>> programmer does daily is termination analysis. There are type systems
>>>>> that guarantee termination, but I think that is fair to say that it
>>>>> is not
>>>>> yet understood how to make a practical general purpose language, whose
>>>>> type system would guarantee termination (or at least I'm not aware
>>>>> of such
>>>>> a language). It should also be clear that termination analysis
>>>>> need not
>>>>> be done informally. Given a program, it may be possible to
>>>>> formally prove
>>>>> that it terminates.
>>>> To make the halting problem decidable one would have to do one of
>>>> two
>>>> things: Depend on memory size limits, or have a language that really is
>>>> less expressive, at a very deep level, than any of the languages
>>>> mentioned in the newsgroups header for this message.
>>> Not quite. See http://en.wikipedia.org/wiki/ACL2
>>
>> What do you mean "not quite"? Of course, Patricia is absolutely
>> right. Termination-guaranteeing languages are fundamentally less
>> expressive than Turing-complete languages. ACL2 was not mentioned in
>> the newsgroup header.
>
> ACL2 is a subset of Common Lisp, and programs written in ACL2 are
> executable in Common Lisp. comp.lang.lisp is not only about Common Lisp,
> but even if it were, ACL2 would fit.
To prove Turing-completeness of ACL2 from Turing-completeness of Common
Lisp you would need to run the reduction the other way round, showing
that any Common Lisp program can be converted to, or emulated by, an
ACL2 program.
Patricia
------------------------------
Date: Fri, 23 Jun 2006 09:37:24 -0500
From: Matthias Blume <find@my.address.elsewhere>
Subject: Re: Saying "latently-typed language" is making a category mistake
Message-Id: <m1hd2ckkez.fsf@hana.uchicago.edu>
Pascal Costanza <pc@p-cos.net> writes:
> Matthias Blume wrote:
>> Pascal Costanza <pc@p-cos.net> writes:
>>
>>> Patricia Shanahan wrote:
>>>> Vesa Karvonen wrote:
>>>> ...
>>>>> An example of a form of informal reasoning that (practically) every
>>>>> programmer does daily is termination analysis. There are type systems
>>>>> that guarantee termination, but I think that is fair to say that it
>>>>> is not
>>>>> yet understood how to make a practical general purpose language, whose
>>>>> type system would guarantee termination (or at least I'm not aware
>>>>> of such
>>>>> a language). It should also be clear that termination analysis need not
>>>>> be done informally. Given a program, it may be possible to
>>>>> formally prove
>>>>> that it terminates.
>>>> To make the halting problem decidable one would have to do one of
>>>> two
>>>> things: Depend on memory size limits, or have a language that really is
>>>> less expressive, at a very deep level, than any of the languages
>>>> mentioned in the newsgroups header for this message.
>>> Not quite. See http://en.wikipedia.org/wiki/ACL2
>> What do you mean "not quite"? Of course, Patricia is absolutely
>> right. Termination-guaranteeing languages are fundamentally less
>> expressive than Turing-complete languages. ACL2 was not mentioned in
>> the newsgroup header.
>
> ACL2 is a subset of Common Lisp, and programs written in ACL2 are
> executable in Common Lisp. comp.lang.lisp is not only about Common
> Lisp, but even if it were, ACL2 would fit.
So what?
Patricia said "less expressive", you said "subset". Where is the
contradiction?
Perhaps you could also bring up the subset of Common Lisp where the
only legal program has the form:
nil
Obviously, this is a subset of Common Lisp and, therefore, fits
comp.lang.lisp. Right?
Yes, if you restrict the language to make it less expressive, you can
guarantee termination. Some restrictions that fit the bill already
exist. IMHO, it is still wrong to say that "Lisp guaratees
termination", just because there is a subset of Lisp that does.
Matthias
PS: I'm not sure if this language guarantees termination, though. :-)
------------------------------
Date: Fri, 23 Jun 2006 17:00:58 +0200
From: Pascal Costanza <pc@p-cos.net>
Subject: Re: Saying "latently-typed language" is making a category mistake
Message-Id: <4g2e1bF1kmiteU1@individual.net>
Patricia Shanahan wrote:
> Pascal Costanza wrote:
>> Matthias Blume wrote:
>>> Pascal Costanza <pc@p-cos.net> writes:
>>>
>>>> Patricia Shanahan wrote:
>>>>> Vesa Karvonen wrote:
>>>>> ...
>>>>>> An example of a form of informal reasoning that (practically) every
>>>>>> programmer does daily is termination analysis. There are type
>>>>>> systems
>>>>>> that guarantee termination, but I think that is fair to say that it
>>>>>> is not
>>>>>> yet understood how to make a practical general purpose language,
>>>>>> whose
>>>>>> type system would guarantee termination (or at least I'm not aware
>>>>>> of such
>>>>>> a language). It should also be clear that termination analysis
>>>>>> need not
>>>>>> be done informally. Given a program, it may be possible to
>>>>>> formally prove
>>>>>> that it terminates.
>>>>> To make the halting problem decidable one would have to do one of
>>>>> two
>>>>> things: Depend on memory size limits, or have a language that
>>>>> really is
>>>>> less expressive, at a very deep level, than any of the languages
>>>>> mentioned in the newsgroups header for this message.
>>>> Not quite. See http://en.wikipedia.org/wiki/ACL2
>>>
>>> What do you mean "not quite"? Of course, Patricia is absolutely
>>> right. Termination-guaranteeing languages are fundamentally less
>>> expressive than Turing-complete languages. ACL2 was not mentioned in
>>> the newsgroup header.
>>
>> ACL2 is a subset of Common Lisp, and programs written in ACL2 are
>> executable in Common Lisp. comp.lang.lisp is not only about Common
>> Lisp, but even if it were, ACL2 would fit.
>
> To prove Turing-completeness of ACL2 from Turing-completeness of Common
> Lisp you would need to run the reduction the other way round, showing
> that any Common Lisp program can be converted to, or emulated by, an
> ACL2 program.
Sorry, obviously I was far from being clear. ACL2 is not
Turing-complete. All iterations must be expressed in terms of
well-founded recursion.
Pascal
--
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
------------------------------
Date: Fri, 23 Jun 2006 15:31:57 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: service name package
Message-Id: <449bed4c$0$11066$9b4e6d93@newsread4.arcor-online.net>
Me wrote:
> How can I get a service name using IANA assigned port numbers?
> I want pass a port number and possibly the protocol (tcp,udp,etc)
> and have the name returned.
>
> One package that does this but I can't get to install via CPAN
> is Net::IANA::PortNumbers.
Have look at "perldoc -f getservbyport".
my @data = getservbyport( 21, 'tcp' );
print "Service is: " . $data[0] if( @data );
HTH
-Chris
------------------------------
Date: 23 Jun 2006 07:11:20 -0700
From: "Al" <tiggyboo@gmail.com>
Subject: Using command line argument as variable name
Message-Id: <1151071880.803053.162570@p79g2000cwp.googlegroups.com>
How do I escape (or whatever) a command line argument so that I can use
it's content as a variable name in my program? E.g.:
myprogram myvariable
if ($myvariable =~ ....
Thanks much in advance,
Al
------------------------------
Date: 23 Jun 2006 07:14:10 -0700
From: "Nick of course" <mol10metal@hotmail.com>
Subject: Re: Using command line argument as variable name
Message-Id: <1151072050.954425.259970@g10g2000cwb.googlegroups.com>
Al wrote:
> How do I escape (or whatever) a command line argument so that I can use
> it's content as a variable name in my program? E.g.:
>
> myprogram myvariable
>
> if ($myvariable =~ ....
>
> Thanks much in advance,
> Al
Sense not question make
------------------------------
Date: Fri, 23 Jun 2006 14:16:45 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Using command line argument as variable name
Message-Id: <hJSmg.2110$Xn.392@trnddc05>
Al wrote:
> How do I escape (or whatever) a command line argument so that I can
> use it's content as a variable name in my program? E.g.:
>
> myprogram myvariable
>
> if ($myvariable =~ ....
The keyword you are looking for is symbolic references.
Please see the FAQ ("How can I use a variable as a variable name?") and
numerous earlier postings for details about why this is a Bad Idea (TM) and
what to do instead.
jue
------------------------------
Date: 23 Jun 2006 07:17:09 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Re: Using command line argument as variable name
Message-Id: <1151072229.099530.105380@i40g2000cwc.googlegroups.com>
Al wrote:
> How do I escape (or whatever) a command line argument so that I can use
> it's content as a variable name in my program? E.g.:
>
> myprogram myvariable
>
> if ($myvariable =~ ....
If I'm understanding your intent...
my_script.pl param1 param2
#!/usr/bin/perl
use strict; use warnings;
my ( $arg1, $arg2 ) = @ARGV;
if ( $arg1 =~ m/para/ ) {
print "yay!\n";
}
else {
print "boo!\n";
}
------------------------------
Date: 23 Jun 2006 07:19:40 -0700
From: "darksaga" <darksaga_work@yahoo.com>
Subject: Re: Using command line argument as variable name
Message-Id: <1151072380.213672.204180@p79g2000cwp.googlegroups.com>
use Getopt::Long;
my $msg;
my $msg2;
GetOptions(
'-FLAGNAME=s' => \$msg,
'-FLAGNAME2=s' => \$msg2
);
print "$msg\n$msg2\n"
call your script as follows:
perl myScript.pl -FLAGNAME hello -FLAGNAME2 world
greetz darksaga
------------------------------
Date: 23 Jun 2006 07:24:54 -0700
From: "Al" <tiggyboo@gmail.com>
Subject: Re: Using command line argument as variable name
Message-Id: <1151072694.634062.221090@u72g2000cwu.googlegroups.com>
Nick of course wrote:
> Al wrote:
> > How do I escape (or whatever) a command line argument so that I can use
> > it's content as a variable name in my program? E.g.:
> >
> > myprogram myvariable
> >
> > if ($myvariable =~ ....
> >
> > Thanks much in advance,
> > Al
> Sense not question make
Okay - let's say I have a program called: myprogram, and a command line
argument of: myvariable. I run the program like this:
myprogram myvariable
Within my program, there is an existing variable called: $myvariable
How can I address this variable in terms of the command line argument -
i.e., how do I find the value of $myvariable by referencing what was
passed on the command line? For example:
if ([command line argument substitution designating $myvariable] =~
'hello' )...
Sense make more?
------------------------------
Date: Fri, 23 Jun 2006 14:42:22 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Using command line argument as variable name
Message-Id: <i5Tmg.256$Tk.80@trnddc08>
Al wrote:
> Okay - let's say I have a program called: myprogram, and a command
> line argument of: myvariable. I run the program like this:
>
> myprogram myvariable
>
> Within my program, there is an existing variable called: $myvariable
>
> How can I address this variable in terms of the command line argument
> - i.e., how do I find the value of $myvariable by referencing what was
> passed on the command line? For example:
>
> if ([command line argument substitution designating $myvariable] =~
> 'hello' )...
>
> Sense make more?
Are you actually reading what people are writing? Again:
YOU ARE LOOKING FOR SYMBOLIC REFERENCES. SEE THE FAQ AND DEJANEWS FOR
DETAILS ABOUT WHY THEY ARE EVIL AND WHAT TO USE INSTEAD.
jue
------------------------------
Date: 23 Jun 2006 07:52:36 -0700
From: "Al" <tiggyboo@gmail.com>
Subject: Re: Using command line argument as variable name
Message-Id: <1151074356.612219.78220@m73g2000cwd.googlegroups.com>
Thanks very much for the feedback everybody!
- Al
J=FCrgen Exner wrote:
> Al wrote:
> > How do I escape (or whatever) a command line argument so that I can
> > use it's content as a variable name in my program? E.g.:
> >
> > myprogram myvariable
> >
> > if ($myvariable =3D~ ....
>
> The keyword you are looking for is symbolic references.
> Please see the FAQ ("How can I use a variable as a variable name?") and
> numerous earlier postings for details about why this is a Bad Idea (TM) a=
nd
> what to do instead.
>=20
> jue
------------------------------
Date: Fri, 23 Jun 2006 16:50:06 +0200
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Re: Using command line argument as variable name
Message-Id: <e7gva7$10l$1@mlucom4.urz.uni-halle.de>
Thus spoke Al (on 2006-06-23 16:24):
> Within my program, there is an existing variable called: $myvariable
>
> How can I address this variable in terms of the command line argument -
> i.e., how do I find the value of $myvariable by referencing what was
> passed on the command line? For example:
>
> if ([command line argument substitution designating $myvariable] =~
> 'hello' )...
Names are hash entries in the perl guts,
so use your own hash for your names, like:
my %NAMES;
my ($varname) = shift; # <== will be 'myvariable' etc.
$NAMES{ $varname } = 1e-4;
print "name of variable was: ",
grep { /$varname/ } keys %NAMES;
# above is basically the same as :
# print "name of variable was: ", $varname;
print "\nactual value of it is: ", $NAMES{ $varname }, "\n";
Don't use Perls Name-Hash directly, as most others
here have already said.
Regards
Mirco
------------------------------
Date: Fri, 23 Jun 2006 15:11:49 +0200
From: Andreas Rossberg <rossberg@ps.uni-sb.de>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e7gpal$90ukl$3@hades.rz.uni-saarland.de>
Chris Uppal wrote:
>>>
>>>Well, it seems to me that you are /assuming/ a notion of what kinds of
>>>logic can be called type (theories), and I don't share your
>>>assumptions. No offence intended.
>>
>>OK, but can you point me to any literature on type theory that makes a
>>different assumption?
>
> 'Fraid not. (I'm not a type theorist -- for all I know there may be lots, but
> my suspicion is that they are rare at best.)
I would suspect the same :-). And the reason is that "type" has a
well-established use in theory. It is not just my "assumption", it is
established practice since 80 or so years. So far, this discussion has
not revealed the existence of any formal work that would provide a
theory of "dynamic types" in the sense it is used to characterise
"dynamically typed" languages.
So what you are suggesting may be an interesting notion, but it's not
what is called "type" in a technical sense. Overloading the same term
for something different is not a good idea if you want to avoid
confusion and misinterpretations.
> But, as a sort of half-way, semi-formal, example: consider the type environment
> in a Java runtime. The JVM does formal type-checking of classfiles as it loads
> them. In most ways that checking is static -- it's treating the bytecode as
> program text and doing a static analysis on it before allowing it to run (and
> rejecting what it can't prove to be acceptable by its criteria). However, it
> isn't /entirely/ static because the collection of classes varies at runtime in
> a (potentially) highly dynamic way. So it can't really examine the "whole"
> text of the program -- indeed there is no such thing. So it ends up with a
> hybrid static/dynamic type system -- it records any assumptions it had to make
> in order to find a proof of the acceptability of the new code, and if (sometime
> in the future) another class is proposed which violates those assumptions, then
> that second class is rejected.
Incidentally, I know this scenario very well, because that's what I'm
looking at in my thesis :-). All of this can easily be handled
coherently with well-established type machinery and terminology. No need
to bend existing concepts and language, no need to resort to "dynamic
typing" in the way Java does it either.
> In code which will be executed at instant A
> obj aMessage. "type correct"
> obj anotherMessage. "type incorrect"
>
> In code which will be executed at instant B
> obj aMessage. "type incorrect"
> obj anotherMessage. "type correct"
>
> I don't see how a logic with no temporal element can arrive at all four those
> judgements, whatever it means by a union type.
I didn't say that the type system cannot have temporal elements. I only
said that a type itself cannot change over time. A type system states
propositions about a program, a type assignment *is* a proposition. A
proposition is either true or false (or undecidable), but it is so
persistently, considered under the same context. So if you want a type
system to capture temporal elements, then these must be part of a type
itself. You can introduce types with implications like "in context A,
this is T, in context B this is U". But the whole quoted part then is
the type, and it is itself invariant over time.
- 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 9357
***************************************