[27995] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9359 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 23 14:10:16 2006

Date: Fri, 23 Jun 2006 11:10:08 -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: 9359

Today's topics:
    Re: What is Expressiveness in a Computer Language <eval.apply@gmail.com>
    Re: What is Expressiveness in a Computer Language <marshall.spight@gmail.com>
    Re: What is Expressiveness in a Computer Language <marshall.spight@gmail.com>
    Re: What is Expressiveness in a Computer Language <eval.apply@gmail.com>
    Re: What is Expressiveness in a Computer Language <rvtol+news@isolution.nl>
    Re: What is Expressiveness in a Computer Language <rvtol+news@isolution.nl>
    Re: What is Expressiveness in a Computer Language <marshall.spight@gmail.com>
    Re: What is Expressiveness in a Computer Language <robert.thorpe@antenova.com>
    Re: What is Expressiveness in a Computer Language <chris.uppal@metagnostic.REMOVE-THIS.org>
    Re: What is Expressiveness in a Computer Language <dnew@san.rr.com>
    Re: What is Expressiveness in a Computer Language <cdsmith@twu.net>
    Re: What is Expressiveness in a Computer Language <cdsmith@twu.net>
    Re: What is Expressiveness in a Computer Language <marshall.spight@gmail.com>
    Re: What is Expressiveness in a Computer Language <cdsmith@twu.net>
    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
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 23 Jun 2006 09:22:54 -0700
From: "Joe Marshall" <eval.apply@gmail.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151079774.429512.68840@c74g2000cwc.googlegroups.com>


Marshall wrote:
> Joe Marshall wrote:
> >
> > That's the important point:  I want to run broken code.
>
> I want to make sure I understand. I can think of several things
> you might mean by this. It could be:
> 1) I want to run my program, even though I know parts of it
> are broken, because I think there are parts that are not broken
> and I want to try them out.

I think I mean a little of each of these.

Nearly *every* program I have ever used is buggy, so this is actually a
normal state of affairs even when I'm not debugging or developing.

> 2) I want to run my program, even though it is broken, and I
> want to run right up to a broken part and trap there, so I can
> use the runtime facilities of the language to inspect what's
> going on.

I do this quite often.  Sometimes I'll develop `in the debugger'.  I'll
change some piece of code and run the program until it traps.  Then,
without exiting the debugger, I'll fix the immediate problem and
restart the program at the point it trapped.  This technique takes a
bit of practice, but if you are working on something that's complex and
has a lot of state, it saves a lot of time because you don't have to
reconstruct the state every time you make a change.

> > I want to run
> > as much of the working fragments as I can, and I want a `safety net' to
> > prevent me from performing undefined operations, but I want the safety
> > net to catch me at the *last* possible moment.
>
> This statement is interesting, because the conventional wisdom (at
> least as I'm used to hearing it) is that it is best to catch bugs
> at the *first* possible moment. But I think maybe we're talking
> about different continua here. The last last last possible moment
> is after the software has shipped to the customer, and I'm pretty
> sure that's not what you mean. I think maybe you mean something
> more like 2) above.

It is often the case that the proximate cause of a bug is nowhere near
where the fix needs to be applied.  This is especially true with the
really hard bugs.  A static type system will tell me that there (may)
exist a path through the code that results in an error, but the runtime
check that fails will provide a witness.



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

Date: 23 Jun 2006 09:28:42 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151080122.252066.106740@i40g2000cwc.googlegroups.com>

Rob Thorpe wrote:
> David Hopwood wrote:
>
> The term "dynamically typed" is well used and understood.  The term
> untyped is generally associated with languages that as you put it "have
> no memory safety", it is a pejorative term.  "Latently typed" is not
> well used unfortunately, but more descriptive.
>
> Most of the arguments above describe a static type system then follow
> by saying that this is what "type system" should mean, and finishing by
> saying everything else should be considered untyped. This seems to me
> to be an effort to associate dynamically typed languages with this
> perjorative term.

I can believe that someone, somewhere out there might have done
this, but I can't recall ever having seen it. In any event, the
standard
term for memory safety is "safety", not "untyped." Further, anyone
who was interested in actually understanding the issues woudn't
be doing what you describe.

And if you did find someone who was actively doing this I would
say "never attribute to malice what can adequately be explained
by stupidity."


Marshall



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

Date: 23 Jun 2006 09:32:13 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151080333.467194.286050@m73g2000cwd.googlegroups.com>

Andreas Rossberg wrote:
> Marshall wrote:
> >
> > What we generally (in programming) call variables are locals
> > and globals. If the languages supports an update operation
> > on those variables, then calling them variables makes sense.
> > But "variable" has become such a catch-all term that we call
> >
> >   public static final int FOO = 7;
> >
> > a variable, even though it can never, ever vary.
> >
> > That doesn't make any sense.
>
> It does, because it is only a degenerate case. In general, you can have
> something like
>
>    void f(int x)
>    {
>       const int foo = x+1;
>       //...
>    }
>
> Now, foo is still immutable, it is a local, but it clearly also varies.

So what then is to be the definition of "variable" if it includes
things that can never vary, because they are only a degenerate
case? Shall it be simply a named value?


Marshall



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

Date: 23 Jun 2006 09:33:01 -0700
From: "Joe Marshall" <eval.apply@gmail.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151080381.150026.236440@r2g2000cwb.googlegroups.com>


Marshall wrote:
> Timo Stamm wrote:
> >
> > This is actually one of the most interesting threads I have read in a
> > long time. If you ignore the evangelism, there is a lot if high-quality
> > information and first-hand experience you couldn't find in a dozen books.
>
> Hear hear! This is an *excellent* thread. The evangelism is at
> rock-bottom
> and the open exploration of other people's way of thinking is at what
> looks to me like an all-time high.

What are you, some sort of neo-static pseudo-relational
object-disoriented fascist?



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

Date: Fri, 23 Jun 2006 18:34:02 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e7hcer.19s.1@news.isolution.nl>

Marshall schreef:

> It seems we have languages:
> with or without static analysis
> with or without runtime type information (RTTI or "tags")
> with or without (runtime) safety
> with or without explicit type annotations
> with or without type inference
>
> Wow. And I don't think that's a complete list, either.

Right. And don't forget that some languages are hybrids in any of those
areas.

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Fri, 23 Jun 2006 18:30:16 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e7hc5d.1c4.1@news.isolution.nl>

Rob Thorpe schreef:

> I would suggest that at least assembly should be referred to as
> "untyped".

There are many different languages under the umbrella of "assembly", so
your suggestion is bound to be false.

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: 23 Jun 2006 09:45:29 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151081129.290382.297530@r2g2000cwb.googlegroups.com>

Pascal Costanza wrote:
> Marshall wrote:
> > Pascal Costanza wrote:
> >> Consider a simple expression like 'a + b': In a dynamically typed
> >> language, all I need to have in mind is that the program will attempt to
> >> add two numbers. In a statically typed language, I additionally need to
> >> know that there must a guarantee that a and b will always hold numbers.
> >
> > I still don't really see the difference.
> >
> > I would not expect that the dynamic programmer will be
> > thinking that this code will have two numbers most of the
> > time but sometimes not, and fail. I would expect that in both
> > static and dynamic, the thought is that that code is adding
> > two numbers, with the difference being the static context
> > gives one a proof that this is so.
>
> There is a third option: it may be that at the point where I am writing
> this code, I simply don't bother yet whether a and b will always be
> numbers. In case something other than numbers pop up, I can then
> make a decision how to proceed from there.

Ouch; I have a really hard time understanding this.

I can't see how you'd call + on a and b if you think they might
not be numbers. If they could be something other than numbers,
and you're treating them as if they are, is that sort of like
doing a case analysis and only filling in one of the cases?
If so, wouldn't you want to record that fact somehow?


Marshall



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

Date: 23 Jun 2006 10:00:23 -0700
From: "Rob Thorpe" <robert.thorpe@antenova.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151082023.504275.257570@i40g2000cwc.googlegroups.com>

Dr.Ruud wrote:
> Rob Thorpe schreef:
>
> > I would suggest that at least assembly should be referred to as
> > "untyped".
>
> There are many different languages under the umbrella of "assembly", so
> your suggestion is bound to be false.

Well yes, it is false, I know of several typed assemblers.
But I mentioned that point elsewhere so I didn't repeat it.  This
thread is huge and I expect no-one will have read it all, so I will be
more clear in future.



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

Date: Fri, 23 Jun 2006 18:09:29 +0100
From: "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <449c1f4d$0$662$bed64819@news.gradwell.net>

Andreas Rossberg wrote:

> 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.

Frivolous response: the word "type" has been in use in the general sense in
which I wish to use it for longer than that.  If theorists didn't want ordinary
people to abuse their technical terms they should invent their own words not
borrow other people's ;-)

Just for interest, here's one item from the OED's entry on "type" (noun):

    The general form, structure, or character distinguishing
    a particular kind, group, or class of beings or objects;
    hence transf. a pattern or model after which something is made.

And it has supporting quotes, here are the first and last:

1843 Mill Logic iv. ii. §3 (1856) II. 192
    When we see a creature resembling an animal, we
    compare it with our general conception of an animal;
    and if it agrees with that general conception, we include
    it in the class. The conception becomes the type of comparison.

1880 Mem. J. Legge vi. 76
    Every creature has a type, a peculiar character of its own.

Interestingly the first one is from:
    John Stuart Mill
    A System of Logic
(but it's not mathematical logic ;-).

OK, I admitted I was being frivolous.  But I really don't see why a type system
(as understood by type theorists) /must/ have no runtime element.  Just as I
wouldn't stop calling a type system a "type system" if it were designed to work
on incomplete information (only part of the program text is available for
analysis) and so could only make judgements of the form "if X then Y".


[JVM dynamic class loading]
> Incidentally, I know this scenario very well, because that's what I'm
> looking at in my thesis :-).

<grin/>


> All of this can easily be handled
> coherently with well-established type machinery and terminology.

I'd be interested to know more, but I suspect I wouldn't understand it :-(


> 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.

But since the evolving type-attribution that I'm thinking of also includes time
as a static element (at each specific time there is a specific attribution of
types), the dynamic logic can also be viewed as invarient in time, since each
judgement is tagged with the moment(s) to which it applies.

But there we go.  I don't expect you to agree, and though I'll read any reply
with interest, I think I've now said all I have to say in this particular
subthread.

Cheers.

    -- chris





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

Date: Fri, 23 Jun 2006 17:06:20 GMT
From: Darren New <dnew@san.rr.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <gcVmg.3875$MF6.3310@tornado.socal.rr.com>

Marshall wrote:
> I can't see how you'd call + on a and b if you think they might
> not be numbers. 

Now substitute "<" for "+" and see if you can make the same argument. :-)


-- 
   Darren New / San Diego, CA, USA (PST)
     Native Americans used every part
     of the buffalo, including the wings.


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

Date: Fri, 23 Jun 2006 11:08:31 -0600
From: Chris Smith <cdsmith@twu.net>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <MPG.1f05cdfeea12187a9896eb@news.altopia.net>

Marshall <marshall.spight@gmail.com> wrote:
> Ouch; I have a really hard time understanding this.
> 
> I can't see how you'd call + on a and b if you think they might
> not be numbers. If they could be something other than numbers,
> and you're treating them as if they are, is that sort of like
> doing a case analysis and only filling in one of the cases?
> If so, wouldn't you want to record that fact somehow?

The obvious answer -- I don't know if it's what Pascal meant -- is that 
they might be 4x4 matrices, or anything else that behaves predictably 
under some operation that could be called addition.  As a mathematical 
analogy, the entire mathematical field of group theory comes from the 
idea of performing operations on values without really knowing what the 
values (or the operations) really are, but only knowing a few axioms by 
which the relationship between the objects and the operation is 
constrained.

[As an interesting coincidence, group theory papers frequently use the 
addition symbol to represent the (arbitrary) binary relation of an 
Abelian group.  Not that this has anything to do with choosing "+" for 
the example here.]

Programming languages do this all the time, as well.  The most popular 
example is the OO sense of the word polymorphism.  That's all about 
being able to write code that works with a range of values regardless of 
(or, at least, a range that less constraining than equlity in) types.

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


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

Date: Fri, 23 Jun 2006 11:13:51 -0600
From: Chris Smith <cdsmith@twu.net>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <MPG.1f05cf3d1a88cce09896ec@news.altopia.net>

Chris Smith <cdsmith@twu.net> wrote:
> Programming languages do this all the time, as well.  The most popular 
> example is the OO sense of the word polymorphism.  That's all about 
> being able to write code that works with a range of values regardless of 
> (or, at least, a range that less constraining than equlity in) types.

It's now dawned on me that I need not have restricted this to the OO 
sense of polymorphism.  So let me rephrase.  Polymorphism *is* when 
programming languages do that.

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


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

Date: 23 Jun 2006 10:15:56 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151082956.067238.45100@b68g2000cwa.googlegroups.com>

Chris Uppal wrote:
>
> 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.

I have to object to the term "hybrid".

Java has a static type system.
Java has runtime tags and tag checks.

The two are distinct, and neither one is less than complete, so
I don't think "hybrid" captures the situation well.


Marshall



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

Date: Fri, 23 Jun 2006 11:20:29 -0600
From: Chris Smith <cdsmith@twu.net>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <MPG.1f05d0cabd0b607e9896ed@news.altopia.net>

Marshall <marshall.spight@gmail.com> wrote:
> Java has a static type system.
> Java has runtime tags and tag checks.

Yes.

> The two are distinct, and neither one is less than complete

How is neither one less than complete?

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


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

Date: 23 Jun 2006 10:20:39 -0700
From: "Rob Thorpe" <robert.thorpe@antenova.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151083239.829296.33030@i40g2000cwc.googlegroups.com>

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.
 The programmer must use his or her memory to substitute for that
facility.  As far as I can see this is a significant distinction and
warrants a further category for latently typed languages.


As a sidenote: the programmer may also create a tagging system to allow
the types to be tracked.  But this is not the same as saying the
language supports types, it is akin to the writing of OO programs in C
using structs.



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

Date: 23 Jun 2006 10:32:11 -0700
From: rossberg@ps.uni-sb.de
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1151083931.162325.268050@g10g2000cwb.googlegroups.com>

Rob Thorpe wrote:
>
> 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.
>  The programmer must use his or her memory to substitute for that
> facility.  As far as I can see this is a significant distinction and
> warrants a further category for latently typed languages.

Take one of these languages. You have a variable that is supposed to
store functions from int to int. Can you test that a given function
meets this requirement?

You see, IMO the difference is marginal. From my point of view, the
fact that you can do such tests *in some very trivial cases* in the
languages you mention is an artefact, nothing fundamental.

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


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