Newsgroups: comp.lang.misc,comp.lang.perl,comp.lang.scheme,comp.lang.tcl,comp.lang.python
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!usenet.ins.cwru.edu!lerc.nasa.gov!purdue!news.cs.indiana.edu!smiale@cs.indiana.edu
From: "Steven Miale" <smiale@cs.indiana.edu>
Subject: Re: What language would you use?
Message-ID: <1994Nov6.073330.5017@news.cs.indiana.edu>
Keywords: scheme tcl tk python language opinion
Organization: Computer Science, Indiana University
References: <39b7ha$j9v@zeno.nscf.org> <39hhjp$lgn@csnews.cs.Colorado.EDU>
Date: Sun, 6 Nov 1994 07:33:24 -0500
Lines: 99
Xref: glinda.oz.cs.cmu.edu comp.lang.misc:18790 comp.lang.perl:38088 comp.lang.scheme:10973 comp.lang.tcl:21409 comp.lang.python:2378

In article <39hhjp$lgn@csnews.cs.Colorado.EDU>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>    That this isn't very far removed from it:
>
>	sub fact {  
>	    my $n = shift;
>	    if ($n < 1) {
>		return 1;
>	    } else {
>		return $n * fact($n - 1);
>	    } 
>	} 

Why should the user have the put $ in front of variables? The computer should
be able to realize these are variables by itself. Tcl does this, too. WHY?

>    (I realize that these examples aren't similar in complexity)

Then why NOT post things similar in complexity? It seems like you've chosen
particularly complex code to prove your point.

For the record, scheme would be

	(define fact
	  (lambda (n)
	    (if (< n 1)
                1
                (* n (fact (- n 1))))))

Python would be:

	define fact(n):
		if n<1:
			return 1
		else:
			return n * fact(n-1)

Here is some perl code from bigint.pl for reference:

sub main'bnorm { #(num_str) return num_str
    local($_) = @_;
    s/\s+//g;                           # strip white space
    if (s/^([+-]?)0*(\d+)$/$1$2/) {     # test if number
	substr($_,0,0) = '+' unless $1; # Add missing sign
	s/^-0/+0/;
	$_;
    } else {
	'NaN';
    }
}

>    or like this; syntactic fascism WRT indentation doesn't seem like
>    the best thing for a novice.  Just make them always use curleys
>    for C/C++/awk/perl/etc, the way tcl does.

I think it *IS* the best thing for a novice. This is the second semester
that I have had to ingrain in people's heads how important it is to use
indentation. Consider...

	- that they will have to use indentation if they expect their code
	  to be readable

	- if you are doing this _anyway_, why not let it do the work for you?

Besides, a lot of students have to wrangle with unbalanced braces, even two
months into the semester. If they used Python, they wouldn't have this problem.

>    easy to understand, although it's certainly possible that this is a
>    factor of your initial programming languages.  For the record, I
>    learned BASIC(-PLUS), Fortran, Pascal, (PDP-11) Assembler, and C
>    before actually becoming a CS major and being exposted to other
>    things.

Very similar to my experience, except I never really learned Fortran, and
learned 6809 assembler instead. 

>* Extendability
>
>    Not sure what you mean by this.  It's not as extensible syntactically
>    as tcl is, but does support dynamically loaded user code in C or perl, 
>    as well as embeddeding in C or C++ code.

How well? In Python, it is trivial to do so. All you have to do is write
a module, and there are plenty of examples. Accessing the data structures
is also easy.

>* object-oriented paradigm
>
>You didn't mention this. :-)  Yes, perl has oo support, as do most
>of the others, but this may not matter to high-school students.

If they are doing GUI stuff, a good OO-based interface will make it
easier to use, as well as giving them the added benefit of learning OOP
early on. The Python interface to Tk is OO-based. 

Steve

-- 
Steven Miale  <http://www.cs.indiana.edu/hyplan/smiale.html>
