[28005] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9369 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 24 14:10:21 2006

Date: Sat, 24 Jun 2006 11:10:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 24 Jun 2006     Volume: 10 Number: 9369

Today's topics:
    Re: What is Expressiveness in a Computer Language <david.nospam.hopwood@blueyonder.co.uk>
    Re: What is Expressiveness in a Computer Language <david.nospam.hopwood@blueyonder.co.uk>
    Re: What is Expressiveness in a Computer Language <david.nospam.hopwood@blueyonder.co.uk>
    Re: What is Expressiveness in a Computer Language <david.nospam.hopwood@blueyonder.co.uk>
    Re: What is Expressiveness in a Computer Language <anton@appsolutions.com>
    Re: What is Expressiveness in a Computer Language <anton@appsolutions.com>
    Re: What is Expressiveness in a Computer Language <anton@appsolutions.com>
    Re: What is Expressiveness in a Computer Language <marshall.spight@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 24 Jun 2006 15:13:02 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <2Ecng.463176$tc.227775@fe2.news.blueyonder.co.uk>

Rob Thorpe wrote:
> Andreas Rossberg wrote:
>>Rob Thorpe wrote:
>>
>>>Its easy to create a reasonable framework.
>>
>>Luca Cardelli has given the most convincing one in his seminal tutorial
>>"Type Systems", where he identifies "typed" and "safe" as two orthogonal
>>dimensions and gives the following matrix:
>>
>>           | typed | untyped
>>    -------+-------+----------
>>    safe   | ML    | Lisp
>>    unsafe | C     | Assembler
>>
>>Now, jargon "dynamically typed" is simply untyped safe, while "weakly
>>typed" is typed unsafe.
> 
> Consider a langauge something like BCPL or a fancy assembler, but with
> not quite a 1:1 mapping with machine langauge.
> 
> It differs in one key regard: it has a variable declaration command.
> This command allows the programmer to allocate a block of memory to a
> variable.  If the programmer attempts to index a variable outside the
> block of memory allocated to it an error will occur.  Similarly if the
> programmer attempts to copy a larger block into a smaller block an
> error would occur.
> 
> Such a language would be truly untyped and "safe", that is safe
> according to many peoples use of the word including, I think, yours.
> 
> But it differs from latently typed languages like python, perl or lisp.
> In such a language there is no information about the type the variable
> stores. The programmer cannot write code to test it, and so can't
> write functions that issue errors if given arguments of the wrong type.

So the hypothetical language, unlike Python, Perl and Lisp, is not
dynamically *tagged*.

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


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

Date: Sat, 24 Jun 2006 15:15:51 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <HGcng.463183$tc.147087@fe2.news.blueyonder.co.uk>

Dr.Ruud wrote:
> Marshall schreef:
>>Rob Thorpe:
> 
>>>Can I make a type in C that can only have values between 1 and 10?
>>>How about a variable that can only hold odd numbers, or, to make it
>>>more difficult, say fibonacci numbers?
>>
>>Well, of course you can't in *C*; you can barely zip you pants with C.
>>But I believe you can do the above in C++, can't you?
> 
> You can write self-modifying code in C, so I don't see how you can not
> do that in C. ;)

Strictly speaking, you can't write self-modifying code in Standard C.

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


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

Date: Sat, 24 Jun 2006 15:30:36 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <wUcng.475931$xt.353687@fe3.news.blueyonder.co.uk>

Chris Uppal wrote:
> David Hopwood wrote:
> 
>>>But some of the advocates of statically
>>>typed languages wish to lump these languages together with assembly
>>>language a "untyped" in an attempt to label them as unsafe.
>>
>>A common term for languages which have defined behaviour at run-time is
>>"memory safe". For example, "Smalltalk is untyped and memory safe."
>>That's not too objectionable, is it?
> 
> I find it too weak, as if to say: "well, ok, it can't actually corrupt memory
> as such, but the program logic is still apt go all over the shop"...

Well, it might ;-)

(In case anyone thinks I am being pejorative toward not-statically-typed
languages here, I would say that the program logic can *also* "go all over
the shop" in a statically typed, memory safe language. To avoid this, you
need at least a language that is "secure" in the sense used in capability
systems, which is a stronger property than memory safety.)

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


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

Date: Sat, 24 Jun 2006 15:38:08 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <A%cng.475952$xt.286049@fe3.news.blueyonder.co.uk>

Anton van Straaten wrote:
> I'm suggesting that if a language classifies and tags values in a way
> that supports the programmer in static reasoning about the behavior of
> terms, that calling it "untyped" does not capture the entire picture,
> even if it's technically accurate in a restricted sense (i.e. in the
> sense that terms don't have static types that are known within the
> language).
> 
> Let me come at this from another direction: what do you call the
> classifications into number, string, vector etc. that a language like
> Scheme does?  And when someone writes a program which includes the
> following lines, how would you characterize the contents of the comment:
> 
> ; third : integer -> integer
> (define (third n) (quotient n 3))

I would call it an informal type annotation. But the very fact that
it has to be expressed as a comment, and is not checked, means that
the *language* is not typed (even though Scheme is dynamically tagged,
and even though dynamic tagging provides *partial* support for a
programming style that uses this kind of informal annotation).

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


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

Date: Sat, 24 Jun 2006 16:43:21 GMT
From: Anton van Straaten <anton@appsolutions.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <JYdng.156673$F_3.102006@newssvr29.news.prodigy.net>

David Hopwood wrote:
> I can accept that dynamic tagging provides some support for latent typing
> performed "in the programmer's head". But that still does not mean that
> dynamic tagging is the same thing as latent typing

No, I'm not saying it is, although I am saying that the former supports 
the latter.

> or that languages
> that use dynamic tagging are "latently typed". This simply is not a
> property of the language (as you've already conceded).

Right.  I see at least two issues here: one is that as a matter of 
shorthand, compressing "language which supports latent typing" to 
"latently-typed language" ought to be fine, as long as the term's 
meaning is understood.

But beyond that, there's an issue here about the definition of "the 
language".  When programming in a latently-typed language, a lot of 
action goes on outside the language - reasoning about static properties 
of programs that are not captured by the semantics of the language.

This means that there's a sense in which the language that the 
programmer programs in is not the same language that has a formal 
semantic definition.  As I mentioned in another post, programmers are 
essentially mentally programming in a richer language - a language which 
has informal (static) types - but the code they write down elides this 
type information, or else puts it in comments.

We have to accept, then, that the formal semantic definitions of 
dynamically-checked languages are incomplete in some important ways. 
Referring to those semantic definitions as "the language", as though 
that's all there is to the language in a broader sense, is misleading.

In this context, the term "latently-typed language" refers to the 
language that a programmer experiences, not to the subset of that 
language which is all that we're typically able to formally define.

Anton


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

Date: Sat, 24 Jun 2006 16:54:36 GMT
From: Anton van Straaten <anton@appsolutions.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <g7eng.156935$F_3.115360@newssvr29.news.prodigy.net>

Chris Smith wrote:
> Dr.Ruud <rvtol+news@isolution.nl> wrote:
 ...
>>The 'dynamic type' is just another type.
> 
> 
> That's essentially equivalent to giving up.  I doubt many people would 
> be happy with the conclusion that dynamically typed languages are typed, 
> but have only one type which is appropriate for all possible operations.  

I'm not sure if this is what you're getting at, but what you've written 
is precisely the position that type theorists take.  Having "only one 
type which is appropriate for all possible operations" is exactly what 
the term "untyped" implies.

> That type system would not be implemented, since it's trivial and 
> behaves identically to the lack of a type system, and then we're back 
> where we started.

This is why I've suggested that "untyped" can be a misleading term, when 
applied to dynamically-typed languages.

Anton


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

Date: Sat, 24 Jun 2006 17:19:16 GMT
From: Anton van Straaten <anton@appsolutions.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <oueng.157315$F_3.111244@newssvr29.news.prodigy.net>

David Hopwood wrote:
> Anton van Straaten wrote:
 ...
>>When you get to more complex cases, though, most type inferencers for
>>Scheme assign traditional static-style types to terms.  If you think
>>about this in conjunction with the term "latent types", it's an obvious
>>connection to make that what the inferencer is doing is recovering types
>>that are latent in the source.
> 
> 
> But these types are not part of the Scheme language. If you combine Scheme
> with a type inferencer, you get a new language that is not R*RS Scheme,
> and *that* language is typed.

Sure.  So one obvious question, as I've just observed in another reply 
to you, is which language programmers actually program in.  I'd say that 
they certainly don't program in the completely untyped language as 
defined by RnRS.

> Note that different inferencers will give different type assignments.
> They may be similar, but they may also be quite dissimilar in some cases.
> This casts considerable doubt on the assertion that the inferencer is
> "recovering types latent in the source".

I mentioned this earlier, in a reply to Marshall where I gave an 
informal definition of latent typing, which read in part: "Terms in the 
program may be considered as having static types, and it is possible to 
infer those types, but it isn't necessarily easy to do so automatically, 
and there are usually many possible static type schemes that can be 
assigned to a given program."

As far as the term "recovering" goes, that perhaps shouldn't be taken 
too literally.  It's clearly not the case that a latently-typed program 
has a single formalizable type scheme which was put there deliberately 
by the programmer.  But programmers do reason about things like the 
types of functions and expressions, and the goal of soft type 
inferencers is to find an approximation to what the programmer intended.

Anton


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

Date: 24 Jun 2006 10:43:27 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151171007.230666.235430@r2g2000cwb.googlegroups.com>

Anton van Straaten wrote:
>
> But beyond that, there's an issue here about the definition of "the
> language".  When programming in a latently-typed language, a lot of
> action goes on outside the language - reasoning about static properties
> of programs that are not captured by the semantics of the language.
>
> This means that there's a sense in which the language that the
> programmer programs in is not the same language that has a formal
> semantic definition.  As I mentioned in another post, programmers are
> essentially mentally programming in a richer language - a language which
> has informal (static) types - but the code they write down elides this
> type information, or else puts it in comments.
>
> We have to accept, then, that the formal semantic definitions of
> dynamically-checked languages are incomplete in some important ways.
> Referring to those semantic definitions as "the language", as though
> that's all there is to the language in a broader sense, is misleading.
>
> In this context, the term "latently-typed language" refers to the
> language that a programmer experiences, not to the subset of that
> language which is all that we're typically able to formally define.

That is starting to get a bit too mystical for my tastes.


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


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