Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Perl *is* strongly typed (was Re: Perl description)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark-Jason Dominus  
View profile  
 More options Jun 23 2001, 11:50 am
Newsgroups: comp.lang.perl.moderated
From: Mark-Jason Dominus <m...@plover.com>
Date: Sat, 23 Jun 2001 11:33:05 -0400
Local: Sat, Jun 23 2001 11:33 am
Subject: Re: Perl *is* strongly typed (was Re: Perl description)

Benjamin Goldberg <gold...@earthlink.net>:

> Another example:
>    perl -e "[]->{0}"
> If Perl were loosly typed, perl would actually call the hash fetch
> subroutines with the reference to an array.  Since it's not that loosly
> typed, it detects that the lhs is not a hash ref, and prints out an
> error message and exits.

OK, fair enough.  But I would have said that a type system that only
has three or four types in it was a very weak type system indeed.
Fortran IV (1966) has more types than that, and I don't think many
people would claim that Fortran was a strongly typed language; my
previous message showed that AWK has similar checks, and I have never
known anyone to make the claim that AWK is a strongly typed language.

My argument wasn't that Perl isn't strongly typed, because I don't
pretend to know what that means.  Let me say that again: I don't know
what it means for a language to be 'strongly typed'.  I'm not arguing
with you because I think you're wrong and I think Perl is not a
strongly typed language.  I do not know what 'strongly typed language'
means.  (I did some research, and it didn't help; see below.)

All I said was that if Perl is considered strongly typed, then I don't
think the concept is useful or meaningful, because *every* language is
strongly typed.  It appears from your argument above that you would
consider AWK and Fortran IV to be strongly typed languages also.  That
may be a logcially consistent position to take, but it does not seem
to be a very useful one.  My original message asked Randal to produce
an example of a language that is *not* strongly typed, and I don't
think you can do that---if you're going to rule out examples like AWK,
that doesn't leave you with very much to work with.  (I guess you
could bring up assembly language.  But that would be a silly evasion.)

>From a brief survey of web documents about strong typing, it appears

that the description 'strongly typed language' does *not* have any
useful or agreed-upon meaning.  The confusion is not simply about
where to draw a line on a linear scale of type granularity or degree
of error checking or anything like that; it's not that some people
think a strongly-typed language needs fifty types and others think it
needs only thirty.  There appears to be a fundamental confusion about
the basic meaning of the term 'strongly typed language'.  In a couple
of hours, I found eight different and incompatible definitions of
'strongly typed language':

        1. A language is strongly typed if type annotations are
           associated with variable names, rather than with values.
           If types are attached to values, it is weakly typed.

        2. A language is strongly typed if it contains compile-time
           checks for type constraint violations.  If checking is
           deferred to run time, it is weakly typed.

        3. A language is strongly typed if it has compile or run-time
           checks for type constraint violations.  If no checking is
           done, it is weakly typed.

        4. A language is strongly typed if conversions between
           different types are forbidden.  If such conversions are
           allowed, it is weakly typed.

        5. A language is strongly typed if conversions between
           different types must be indicated explicitly.  If
           implicit conversions are performed, it is weakly typed.

        6. A language is strongly typed if there is no language-level
           way to disable or evade the type system.  If there are
           casts or other type-evasive mechansisms, it is weakly typed.

        7. A language is strongly typed if it has a complex,
           fine-grained type system with compound types.  If it has
           only a few types, or only scalar types, it is weakly typed.

        8. A language is strongly typed if the type of its data
           objects is fixed and does not vary over the lifetime of the
           object.  If the type of a datum can change, the language is
           weakly typed.          

Some of these are contradictory; some are merely orthogonal.  Many
came from class notes for undergraduate CS courses.  Not all of these
instructors and experts can be mistaken.  The only sensible conclusion
is that there is no agreement about what it means to be a strongly
typed language.

Examples are no help here:

I found several pages that asserted that C is a strongly-typed language.
I found several pages that asserted that C is a weakly-typed language.

I found several pages that asserted that C++ is a strongly-typed language.
I found several pages that asserted that C++ is a weakly-typed language.

I found several pages that asserted that Lisp is a strongly-typed language.
I found several pages that asserted that Lisp is a weakly-typed language.

I found several pages that asserted that Perl is a strongly-typed language.
I found several pages that asserted that Perl is a weakly-typed language.

It now appears to me that the topic under discussion, whether Perl is
a strongly or a weakly typed language, is as meaningless as the
related question of whether Perl sux or roolz, so I will withdraw from
the discussion.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google