[27959] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9323 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 20 11:10:13 2006

Date: Tue, 20 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           Tue, 20 Jun 2006     Volume: 10 Number: 9323

Today's topics:
    Re: What is Expressiveness in a Computer Language <robert.thorpe@antenova.com>
    Re: What is Expressiveness in a Computer Language <ketil+news@ii.uib.no>
    Re: What is Expressiveness in a Computer Language <rossberg@ps.uni-sb.de>
    Re: What is Expressiveness in a Computer Language <cdsmith@twu.net>
    Re: What is Expressiveness in a Computer Language <David.Squire@no.spam.from.here.au>
    Re: What is Expressiveness in a Computer Language <robert.thorpe@antenova.com>
    Re: What is Expressiveness in a Computer Language <rossberg@ps.uni-sb.de>
    Re: What's ^$ mean? <rvtol+news@isolution.nl>
    Re: What's ^$ mean? <jurgenex@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 20 Jun 2006 06:11:58 -0700
From: "Rob Thorpe" <robert.thorpe@antenova.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1150809118.677124.142230@u72g2000cwu.googlegroups.com>

Andreas Rossberg wrote:
> Rob Thorpe wrote:
> >
> > No, that isn't what I said.  What I said was:
> > "A language is latently typed if a value has a property - called it's
> > type - attached to it, and given it's type it can only represent values
> > defined by a certain class."
>
> "it [= a value] [...] can [...] represent values"?

???

> > Easy, any statically typed language is not latently typed.  Values have
> > no type associated with them, instead variables have types.
>
> A (static) type system assigns types to (all) *expressions*.

That's right most of the time yes, I probably should have said
expressions.  Though I can think of static typed languages where the
resulting type of an expression depends on the type of the variable it
is being assigned to.

> This includes values as well as variables.

Well I haven't programmed in any statically typed language where values
have types themselves.  Normally the language only knows that variable
Z is of type Q because it's in a variable of type Q, or as you mention
an expression of type Q.  There are many things that could be
considered more than one type.  The integer 45 could be unsigned 45 or
signed 45 or even float 45 depending on the variable it's in, but
without context it doesn't have a precise type.

It does imply the type to some extent though, you could imagine a
language where every value has a precise type.  So, you've found a hole
in my definition.

Maybe a better definition would be:-

if (variables have types || expressions have types) <lang is statically
typed>
else if (values have types) <lang is latently/dynamically typed>
else <lang is untyped>

That seems to fit usage, quite well.

Even then there are problems.  Perl has static types for arrays, hashs
and scalars.  But scalars themselves can be integers, strings, etc.

> Don't confuse type assignment with type annotation (which many
> mainstream languages enforce for, but also only allow for, variable
> declarations).

Point taken.



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

Date: Tue, 20 Jun 2006 15:16:32 +0200
From: Ketil Malde <ketil+news@ii.uib.no>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <eglkrs0xxr.fsf@polarvier.ii.uib.no>

Andreas Rossberg <rossberg@ps.uni-sb.de> writes:

>> "A language is latently typed if a value has a property - called it's
>> type - attached to it, and given it's type it can only represent values
>> defined by a certain class."

I thought the point was to separate the (bitwise) representation of a
value from its interpretation (which is its type).  In a static
system, the interpretation is derived from context, in a dynamic
system values must carry some form of tags specifying which
interpretation to use. 

I think this applies - conceptually, at least - also to expressions?

My impression is that dynamic typers tend to include more general
properties in their concept of types (div by zero, srqt of negatives,
etc). 

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


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

Date: Tue, 20 Jun 2006 15:53:29 +0200
From: Andreas Rossberg <rossberg@ps.uni-sb.de>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e78ukp$8usvs$3@hades.rz.uni-saarland.de>

Rob Thorpe wrote:
>>
>>>No, that isn't what I said.  What I said was:
>>>"A language is latently typed if a value has a property - called it's
>>>type - attached to it, and given it's type it can only represent values
>>>defined by a certain class."
>>
>>"it [= a value] [...] can [...] represent values"?
> 
> ???

I just quoted, in condensed form, what you said above: namely, that a 
value represents values - which I find a strange and circular definition.

>>A (static) type system assigns types to (all) *expressions*.
> 
> That's right most of the time yes, I probably should have said
> expressions.  Though I can think of static typed languages where the
> resulting type of an expression depends on the type of the variable it
> is being assigned to.

Yes, but that's no contradiction. A type system does not necessarily 
assign *unique* types to individual expressions (consider overloading, 
subtyping, polymorphism, etc).

> Well I haven't programmed in any statically typed language where values
> have types themselves.

They all have - the whole purpose of a type system is to ensure that any 
expression of type T always evaluates to a value of type T. So when you 
look at type systems formally then you certainly have to assign types to 
values, otherwise you couldn't prove any useful property about those 
systems (esp. soundness).

- Andreas


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

Date: Tue, 20 Jun 2006 08:19:53 -0600
From: Chris Smith <cdsmith@twu.net>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <MPG.1f01b1f6ac0e45ec9896cf@news.altopia.net>

Rob Thorpe <robert.thorpe@antenova.com> wrote:
> I'm not talking about correctness, I'm talking about typing.
> 

Since you wrote that, I've come to understand that you meant something 
specific by "property" which I didn't understand at first.  From my 
earlier perspective, it was obvious that correctness was a property of a 
value.  I now realize that you meant a property that's explicitly 
associated with the value and plays a role in determining the behavior 
of the language.  Sorry for the confusion.

> No, that isn't what I said.  What I said was:
> "A language is latently typed if a value has a property - called it's
> type - attached to it, and given it's type it can only represent values
> defined by a certain class."

No, to answer Andreas' concern, you would only need to say:

    ... if a value has a property - called it's type - attached to it,
    and the language semantics guarantees that only values defined by a
    certain class may have that same property attached.

> Easy, any statically typed language is not latently typed.

I'm actually not sure I agree with this at all.  I believe that 
reference values in Java may be said to be latently typed.  This is the 
case because each reference value (except null, which may be tested 
separately) has an explicit property (called its "class", but surely the 
word doesn't make any difference), such that the language semantics 
guarantees that only a certain class of values may have that same 
property, and the property is used to determine behavior of the language 
in many cases (for example, in the case of type-based polymorphism, or 
use of Java's instanceof operator).  Practically all class-based OO 
languages are subject to similar consideration, as it turns out.

I'm unsure whether to consider explicitly stored array lengths, which 
are present in most statically typed languages, to be part of a "type" 
in this sense or not.

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


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

Date: Tue, 20 Jun 2006 15:29:36 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e790og$4t6$1@news.ox.ac.uk>

Andreas Rossberg wrote:
> Rob Thorpe wrote:
>>>
>>>> No, that isn't what I said.  What I said was:
>>>> "A language is latently typed if a value has a property - called it's
>>>> type - attached to it, and given it's type it can only represent values
>>>> defined by a certain class."
>>>
>>> "it [= a value] [...] can [...] represent values"?
>>
>> ???
> 
> I just quoted, in condensed form, what you said above: namely, that a 
> value represents values - which I find a strange and circular definition.
> 

But you left out the most significant part: "given it's type it can only 
represent values *defined by a certain class*" (my emphasis). In C-ish 
notation:

     unsigned int x;

means that x can only represent elements that are integers elements of 
the set (class) of values [0, MAX_INT]. Negative numbers and non-integer 
numbers are excluded, as are all sorts of other things.

You over-condensed.

DS

NB. This is not a comment on static, latent, derived or other typing, 
merely on summarization.



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

Date: 20 Jun 2006 07:57:41 -0700
From: "Rob Thorpe" <robert.thorpe@antenova.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1150815461.210286.53120@r2g2000cwb.googlegroups.com>

Andreas Rossberg wrote:
> Rob Thorpe wrote:
> >>
> >>>No, that isn't what I said.  What I said was:
> >>>"A language is latently typed if a value has a property - called it's
> >>>type - attached to it, and given it's type it can only represent values
> >>>defined by a certain class."
> >>
> >>"it [= a value] [...] can [...] represent values"?
> >
> > ???
>
> I just quoted, in condensed form, what you said above: namely, that a
> value represents values - which I find a strange and circular definition.

Yes, but the point is, as the other poster mentioned: values defined by
a class.
For example, in lisp:
"xyz" is a string, #(1 2 3) is an array, '(1 2 3) is a list, 45 is a
fixed-point number.
Each item that can be stored has a type, no item can be stored without
one.  The types can be tested.  Most dynamic typed languages are like
that.

Compare this to an untyped language where types cannot generally be
tested.

> >>A (static) type system assigns types to (all) *expressions*.
> >
> > That's right most of the time yes, I probably should have said
> > expressions.  Though I can think of static typed languages where the
> > resulting type of an expression depends on the type of the variable it
> > is being assigned to.
>
> Yes, but that's no contradiction. A type system does not necessarily
> assign *unique* types to individual expressions (consider overloading,
> subtyping, polymorphism, etc).

That's a fair way of looking at it.

> > Well I haven't programmed in any statically typed language where values
> > have types themselves.
>
> They all have - the whole purpose of a type system is to ensure that any
> expression of type T always evaluates to a value of type T.

But it only gaurantees this because the variables themselves have a
type, the values themselves do not.  Most of the time the fact that the
variable they are held in has a type infers that the value does too.
But the value itself has no type, in a C program for example I can take
the value from some variable and recast it in any way I feel and the
language cannot correct any errors I make because their is no
information in the variable to indicate what type it is.

> So when you
> look at type systems formally then you certainly have to assign types to
> values, otherwise you couldn't prove any useful property about those
> systems (esp. soundness).

Yes, but indirectly.



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

Date: Tue, 20 Jun 2006 16:42:14 +0200
From: Andreas Rossberg <rossberg@ps.uni-sb.de>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e791g6$8usvs$4@hades.rz.uni-saarland.de>

David Squire wrote:
> Andreas Rossberg wrote:
> 
>> Rob Thorpe wrote:
>>
>>>>
>>>>> No, that isn't what I said.  What I said was:
>>>>> "A language is latently typed if a value has a property - called it's
>>>>> type - attached to it, and given it's type it can only represent 
>>>>> values
>>>>> defined by a certain class."
>>>>
>>>>
>>>> "it [= a value] [...] can [...] represent values"?
>>>
>>>
>>> ???
>>
>> I just quoted, in condensed form, what you said above: namely, that a 
>> value represents values - which I find a strange and circular definition.
> 
> But you left out the most significant part: "given it's type it can only 
> represent values *defined by a certain class*" (my emphasis).

That qualification does not remove the circularity from the definition.

> In C-ish notation:
> 
>     unsigned int x;
> 
> means that x can only represent elements that are integers elements of 
> the set (class) of values [0, MAX_INT]. Negative numbers and non-integer 
> numbers are excluded, as are all sorts of other things.

I don't see how that example is relevant, since the above definition 
does not mention variables.

- Andreas


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

Date: Tue, 20 Jun 2006 14:55:36 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: What's ^$ mean?
Message-Id: <e792i8.e4.1@news.isolution.nl>

Davy schreef:

> Is ^$ mean a NULL line?


Nice riddle!

Can I ask yes/no-questions? If yes:
Is you read the posting guidelines?

Show us the effective code that uses that "^$". Where does it fail?

If you want to learn to use regular expressions, read perlre and
friends.

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Tue, 20 Jun 2006 14:11:12 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: What's ^$ mean?
Message-Id: <4mTlg.22483$YI2.5690@trnddc01>

Davy wrote:
> Is ^$ mean a NULL line?

In Perl a lot depends on context, e.g. scalar versus list context.
Therefore you will have to tell us at least a little bit about in which 
context you stumbled across this character combination.

jue 




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

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


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