Subject: Re: Fwd: Re: Basic Compiler

From: Shlomi Fish <[email-masked]>
Date: Mon, 11 Feb 2002 16:59:44 +0200 (IST)

On 11 Feb 2002, Oleg Goldshmidt wrote:

>
> Adi Stav <[email-masked]> writes:
>
> > Ye Gawds... First object-oriented FORTRAN, and now multi-threaded
> > Logo... What will they invent next!? Functional assembly?
>

Actually, I have an idea for a C++ class library that emulates Scheme's
Environments and Frames model. Thus enabling Lexical Scoping, Lambda
Calculus, Closures, CPS, etc.

Of course, this model for the time being only works in my mind[1], and it
has a very limited garbage collector. But it's actually quite usable.

> A quote no less popular than von Neumann's "random number sin" one
> (discussed elsewhere by roughly the same forum) is:
>
> "I don't know what language will they program in in 2050 but it will
> be called Fortran."
>
> [attribution, anyone?]
>

Do not know - Google to the rescue? AFAIK, there is still a lot of old
code which was written in Fortran (mainly for mainframes and stuff like
that), and is still maintained in it. However, completely new code is
usually written in C, C++, VB, Perl, Java, Python, etc.

Before the recession in the computing started, all of those languages
where growing in the number of job offers, while COBOL actually decreased.
And I'm talking about absolute numbers, not just percentage. I don't know
COBOL, but as a language without recursion, and where you have to type
"ADD X TO Y" to do "y += x", I would not say it is very usable, either.

Regards,

	Shlomi Fish

[1] - I did not code it, just proven it correct. :-)

> --
> Oleg Goldshmidt | [email-masked]
> "If it ain't broken, it has not got enough features yet."
>
> =================================================================
> To unsubscribe, send mail to [email-masked] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [email-masked]
>

----------------------------------------------------------------------
Shlomi Fish        [email-masked]
Home Page:         http://t2.technion.ac.il/~shlomif/
Home E-mail:       [email-masked]

"Let's suppose you have a table with 2^n cups..."
"Wait a second - is n a natural number?"

---

From: "Nadav Har'El" <[email-masked]>
Date: Mon, 11 Feb 2002 17:17:06 +0200

> usually written in C, C++, VB, Perl, Java, Python, etc.

What the quote (probably) makes fun of is the fact that as Fortran evolves
it changes so radically every two decades(!) or so, that it is not even clear
why it should be called "Fortran" any more... What people usually refer to
as Fortran is actually Fortran 77, a relatively new standard from 1977
(there was on older version from 1956 ;)). But now there's also Fortran 90
(and Fortran 95) which have radically different features and syntax from
Fortran 77, and copy many of the features of C and C++ (memory allocation,
operator overloading, "pointers", etc.) that were missing from Fortran 77.

It is not true that no new code is written in Fortran nowadays, but most
of such new code is being written in Fortran 90 (even the thick-headed
Fortran diehards realize how silly it is to confine yourself to something
that hasn't changed since 1977). But now that students are no longer being
tought Fortran at the university, and C is being taught instead, the number
of people growing up and wanting to code in Fortran is dwindling.

VB, Perl, Java and Python are completely irrelevant to most Fortraners, by
the way: Fortran (FORmula TRANslator) is mostly used for numeric calculations,
especially by physicists (do they still teach Fortran in the physics department
in the Technion, or have they switched to C too?).

> where growing in the number of job offers, while COBOL actually decreased.

I know someone who's doing a CIS (or something like that) degree in the US
now, and I was shocked to hear that they are teaching them COBOL!

> "ADD X TO Y" to do "y += x", I would not say it is very usable, either.

I'd take such "restrictions" any day, over a language that doesn't have any
concept of memory allocation (namely, Fortran 77) :)

Recursion is highly overrated, in my opinion (let's not start a flamewar
on this :))

-- 
Nadav Har'El                        |      Monday, Feb 11 2002, 29 Shevat 5762
[email-masked]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |Windows detected you moved your mouse.
http://nadav.harel.org.il           |Reboot for this change to take effect.

---

From: Oleg Goldshmidt <[email-masked]>
Date: 11 Feb 2002 17:31:40 +0200

> Calculus, Closures, CPS, etc.

Why bother? There are Scheme2C translators - just write in Scheme.

> usually written in C, C++, VB, Perl, Java, Python, etc.

Fortran is very much alive. I have never learned its OO incarnations,
but I hear they _are_ OO or on the way there (F95 etc - anyone?).

The real reason companies move from Fortran to C/C++ (not really to
others you mentioned - these are basically niche languages and a
Fortran company is not likely to switch to Perl or VB; besides, the
old Fortran code has to be interfaced to somehow, which is possible
from C) is that it is difficult to hire an inexperienced CS graduate
who knows Fortran nowadays.

I used to work for a company that made the transition.

> And I'm talking about absolute numbers, not just percentage. 

Can it be that you didn't look at the right ads (US, not Israel)?

I read (Gabriel?) just a few years ago that there was still much more
*new* code being written in Cobol that in any other programming
language. I don't know really if it is true. I would not be surprised,
really: there probably are many more programmers sitting in banks,
insurance companies, etc, doing payroll, taxes, whatever, than in all
of the visible hi-tech. And all those huge Cobol systems need patches,
features, et caetera.

> I don't know COBOL, but as a language without recursion, and where
> you have to type "ADD X TO Y" to do "y += x", I would not say it is
> very usable, either.

Schemer <scoff, smiley>... Fortran does not have recursion either,
IIRC. The Fortran I know, that is. I would not be surprised if newer
ones had recursion, tail-recursion, and all that jazz.

Does "y += x" define a good language for you? 

> [1] - I did not code it, just proven it correct. :-)

More quotes, eh? Knuth.

---

From: "Nadav Har'El" <[email-masked]>
Date: Mon, 11 Feb 2002 17:57:45 +0200

> language. I don't know really if it is true. I would not be surprised,

Some programming statistics are very surprising. I heard another surprising
statistic (like you, I don't have a pointer to prove it): 90% of the code
developed in the US was never meant to be sold - it is either used in-house
or supplied with hardware.
So much for people's fears that "programmers will be out of a job if free
software won"!

> ones had recursion, tail-recursion, and all that jazz.

Well, Fortran 77 did not officially support recursion, but this was never an
important "feature" of the language. After all you did have functions,
"return" statements, so why not recursion?
The problem was that the language standard did not guarantee you that
function-local variables are allocated on the stack, and many implementation
put them in fixed positions in memory during compilation, hence you couldn't
call the same function twice in the same time. Fortran 77 has an explicit
"SAVE" declaration that declares local variables to be saved across function
invocation, but implmentations were free to "SAVE" all local variables.
("SAVE" is just like "static" variables in functions in C, by the way).

Anyway, in new Fortran compilers (even f77 compilers), you usually had a
compiler option (if it wasn't the default already) to put local variables
on the stack. This would sometimes break antique software which assumed all
variables were SAVEd by default (which is a wrong assumption, even by the
Fortran standard).

"The horror, The horror!"

(Yes, another quote... This time Joseph Conrad)

-- 
Nadav Har'El                        |      Monday, Feb 11 2002, 29 Shevat 5762
[email-masked]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |How do you get holy water? Boil the hell
http://nadav.harel.org.il           |out of it.

---

From: Adi Stav <[email-masked]>
Date: Mon, 11 Feb 2002 22:57:51 +0200

> So much for people's fears that "programmers will be out of a job if free

This was said in The Cathedral and the Bazaar, highlighting the
exact same point you mentioned now. The pointer given was an 
unofficial "raise your hand if you develop for in-house use" 
survey ESR did in one of his lectures, and a suggestion for the
reader to try and judge the ratio of sale-value vs. use-value
software by looking at job ads.

Although I like many of the insightful ideas expressed in CatB 
(those that were not lifted wholesale from the GNU manifesto, that
is), I find the sources for most of its supporting evidence rather 
dubious. I'd go as far as to speculate that, if indeed there is
a connection between free software and software developed for in-
house use, the self-selected group that attended the lecture
could have an artificially high ratio of developers interested in
free software, and therefore who develop for in-house use.

---

From: Shlomi Fish <[email-masked]>
Date: Mon, 11 Feb 2002 20:57:48 +0200 (IST)

> now, and I was shocked to hear that they are teaching them COBOL!

My old Music teacher wished to become a programmer and he learned COBOL. I
did not know if he got a job or not. I remember him hacking stuff on the
old XT Basics, when I was young. (he used to be my neighbour)

> Recursion is highly overrated, in my opinion (let's not start a flamewar

I think a usable language has both memory allocation and recursion. "ADD X
TO Y" is an annoyance, but I still think it's counter-intuitive. (or
counter-cognitive). As for recursion, sometimes It's convenient to use it,
and people like to think in recursive processes. Usually, however, it's a
good idea to use one's own dedicated stack if it may be of arbitrary
depth.

Mark-Jason Dominus tells that once recursion was considered a symbol of
the academia, and was not even supported by the languages commonly used
then. (namely COBOL and Fortran) Nowadays, recursion in C, Pascal, Perl,
VB, whatever, is common place.

Regards,

	Shlomi Fish

> To unsubscribe from this group, send an email to:
> [email-masked]
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

---

From: Oleg Goldshmidt <[email-masked]>
Date: 11 Feb 2002 21:00:33 +0200

> ("SAVE" is just like "static" variables in functions in C, by the

True. And some implementations of Fortran 77 (notably f2c/gcc) allowed
the AUTOMATIC keyword to allocate local variables on the stack. I
think that g77 places automatic variables on the stack by default. This
is not a standard feature in f77 though.

---

From: Shlomi Fish <[email-masked]>
Date: Mon, 11 Feb 2002 21:06:08 +0200 (IST)

> of the visible hi-tech. And all those huge Cobol systems need patches,

It is based on statistics presented in Larry Wall's talk "3rd State of the
Onion":

http://www.perl.com/1999/08/onion/talk.html

That was in August 99 as can be deduced from the URL.

> Does "y += x" define a good language for you?

Actually it does. I find it more intutive than "ADD Y TO X", and to a
lesser extent than

(set! y (+ y x))

one of the reasons I don't like Scheme much is because I have to write:

(vector-set! v a (+ (vector-ref v a) 1))

where in Perl I'll write "$v[a]++". I.e: it's far too verbose to be
effective. Let's not start a flame war - every one has his own tastes in
languages.

> > [1] - I did not code it, just proven it correct. :-)

Knuth said that he did not test it, but he actually wrote it. This is a
variation on it.

Regards,

	Shlomi Fish

---

From: Omer Zak <[email-masked]>
Date: Tue, 12 Feb 2002 01:22:51 +0200 (IST)

> On 11 Feb 2002, Oleg Goldshmidt wrote:
[... snipped ...]

> > "I don't know what language will they program in in 2050 but it will

Nowadays, I suppose that this will happen by having someone, who never
knew about FORTRAN, invent a new language, and give it the name FORTRAN.

While FORTRAN was the first language I programmed computers in, nowadays I
refuse to even touch a language, which doesn't type-check the parameters
passed to subroutines/functions, and whose syntax provides no way to
guarantee that a subroutine gets parameter of the correct type.

> usually written in C, C++, VB, Perl, Java, Python, etc.

                                             --- Omer
There is no IGLU Cabal.  Oh, do you mean the JGLV Kubul, but pronounced
the way our ancestors from 250 years ago pronounced words?
WARNING TO SPAMMERS:  see at http://www.zak.co.il/spamwarning.html

---

From: Oleg Goldshmidt <[email-masked]>
Date: 12 Feb 2002 09:37:44 +0200

Shlomi Fish <[email-masked]> writes:

> I think a usable language has both memory allocation and recursion.

I strongly suspect that "usable" is used here in the sense of "usable
for what I like and know how to do". A much more common view is that
high-level programming languages should not deal with memory
allocation.

> people like to think in recursive processes. 

If that were true we would not see so many explanations of why
recursion is no more difficult than iteration (we don't see much of
the reverse, do we?)...