[comp.unix.wizards] Dr David G Korn to speak at SVNet

decot@hpisod2.HP.COM (Dave Decot) (03/04/90)

> Under the title of "The Good, the Bad, and
> the Ugly", Dr. Korn will discuss programming style.  

Not to discourage people from attending, necessarily, but has anyone
ever tried to read the ksh sources?

Dave

evan@plx.UUCP (Evan Bigall) (03/06/90)

In article <14020085@hpisod2.HP.COM> decot@hpisod2.HP.COM (Dave Decot) writes:
>> Under the title of "The Good, the Bad, and
>> the Ugly", Dr. Korn will discuss programming style.  
>
>Not to discourage people from attending, necessarily, but has anyone
>ever tried to read the ksh sources?

ksh was not (I believe) written from scratch, it was based on sh. 

sh contained some of the most notoriously bad sources in all of unix. 
This has lots to do with it being very old, devloped in the infancy of 
c and unix.

It is fairly remarkable how much punch it packs per line though.

Evan

PS: I am not an old timer, but I belive all this to be true
-- 
Evan Bigall, Plexus Software, Santa Clara CA (408)982-4840  ...!sun!plx!evan
"I barely have the authority to speak for myself, certainly not anybody else"

jdarcy@pinocchio.encore.com (Jeff "spackle-man" d'Arcy) (03/06/90)

decot@hpisod2.HP.COM (Dave Decot):
> Not to discourage people from attending, necessarily, but has anyone
> ever tried to read the ksh sources?

evan@plx.UUCP (Evan Bigall):
> ksh was not (I believe) written from scratch, it was based on sh. 
> 
> sh contained some of the most notoriously bad sources in all of unix. 
> This has lots to do with it being very old, devloped in the infancy of 
> c and unix.

Perhaps Dave was misled by the notice in most of the ksh sources that says
"rewritten by David Korn".  Note that the word used is not "enhanced" or
"modified" but "rewritten".  This implies either that Dr. Korn is behind
the not-quite-exemplary coding of ksh or that he is taking an undue amount
of credit for its creation.

Jeff d'Arcy     OS/Network Software Engineer     jdarcy@encore.com
    DISCLAIMER: I don't represent Encore any more than you do

johnl@esegue.segue.boston.ma.us (John R. Levine) (03/07/90)

In article <2289@plx.UUCP> evan@plx.UUCP (Evan Bigall) writes:
>sh contained some of the most notoriously bad sources in all of unix. 
>This has lots to do with it being very old, devloped in the infancy of 
>c and unix.

Not so, the fifth edition had an earlier shell written by John Mashey.
Lots of small hacks were made to it, for instance I added a set of 52
variables $a-$z and $A-$Z.  When Steve Bourne wrote his shell, he evidently
wanted to write it in Algol 68, but in the absence of a working Algol 68
compiler he used #define to make C look surprisingly like Algol 68, coming
up with a strange dialect that the rest of the world found impenetrable.
Somewhat later, around early System III, somebody de-Algolized the sources
and that's basically the current Bourne shell.

I haven't looked at the Korn shell, but anyone who could figure out the Bourne
shell well enough to add all that swell stuff to it has my respect.
-- 
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
"Now, we are all jelly doughnuts."

gwyn@smoke.BRL.MIL (Doug Gwyn) (03/08/90)

In article <14020085@hpisod2.HP.COM> decot@hpisod2.HP.COM (Dave Decot) writes:
>> Under the title of "The Good, the Bad, and
>> the Ugly", Dr. Korn will discuss programming style.  
>Not to discourage people from attending, necessarily, but has anyone
>ever tried to read the ksh sources?

Yeah, I know what you mean.  It could, however, still be that DGK has
things to say that are worth hearing.  An analogy would be BWK's code
found in DWB software (e.g. "pic") that uses type punning and so forth,
quite against the good advice he gives in his books.  (I asked him
about this, and he came up with an excuse, but I don't buy it.)

Our motto: "Do as I say, not as I do."

roe@sobeco.com (r.peterson) (03/12/90)

From article <2289@plx.UUCP>, by evan@plx.UUCP (Evan Bigall):
> In article <14020085@hpisod2.HP.COM> decot@hpisod2.HP.COM (Dave Decot) writes:
>>> Under the title of "The Good, the Bad, and
>>> the Ugly", Dr. Korn will discuss programming style.  
>>
>>Not to discourage people from attending, necessarily, but has anyone
>>ever tried to read the ksh sources?
> 
> ksh was not (I believe) written from scratch, it was based on sh. 
> 
> sh contained some of the most notoriously bad sources in all of unix. 
> This has lots to do with it being very old, devloped in the infancy of 
> c and unix.

And even more to do with the fact that Bourne used the preprocessor
to turn C into a bizarre pascal-lookalike.  Truly the most difficult
code I've ever tried to modify.
-- 
"Norf gribble mitz der bork bork bork?"        Roe Peterson
"Lick spittle dwing dtz fritz slppp!"          roe@sobeco.com
	- Uncle Duke                           uunet!sobeco!roe

anw@maths.nott.ac.uk (Dr A. N. Walker) (03/15/90)

In article <1990Mar11.160403.27949@sobeco.com> roe@sobeco.com
(r.peterson) writes:
>And even more to do with the fact that Bourne used the preprocessor
>to turn C into a bizarre pascal-lookalike.  Truly the most difficult
>code I've ever tried to modify.

	Actually, he used it to turn an Algol lookalike [not very!]
into C.  Some of us old-timers found it quite readable.  I've seen
much worse code over the years.

-- 
Andy Walker, Maths Dept., Nott'm Univ., UK.
anw@maths.nott.ac.uk

mash@mips.COM (John Mashey) (03/22/90)

In article <1990Mar7.052552.11154@esegue.segue.boston.ma.us> johnl@esegue.segue.boston.ma.us (John R. Levine) writes:
>In article <2289@plx.UUCP> evan@plx.UUCP (Evan Bigall) writes:
>>sh contained some of the most notoriously bad sources in all of unix. 
>>This has lots to do with it being very old, devloped in the infancy of 
>>c and unix.
>
>Not so, the fifth edition had an earlier shell written by John Mashey.
>Lots of small hacks were made to it, for instance I added a set of 52
>variables $a-$z and $A-$Z.  When Steve Bourne wrote his shell, he evidently

Not quite right.  Various PWB editions had shells that I'd done work on,
but none of the research editions.

The "PWB shell"** was basically a Thompson shell with:
	a) simple 1-letter variables
	b) more control structure commands, such as if-then-else-endif,
	switch, etc [earlier], and moved into the shell for speed [later].
	c) use of a little extra state in the u-block, such as a person's
	home directory, where we kept the file givingthe person's
	search path, i.e., this was the special case that eventually
	got generealized into the environment in V
	d) Numerous small tweaks to make it more useful for shell
	programming.
Some of the earlier work was done by Dick Haight after harassment by me,
and then I did the later work.

This shell was never remotely elegant, as:
	a) It was required to be completely upward compatible.
	b) It had to be fast and useful on 128K PDP-11/45s supporting
	16-24 users [which was the dominant machine available when most
	of the work was done; PDP-11/70s with monstrous 1MB memories
	became available only after most of this was done.]
	c) Working on it was interleaved with a zillion other things,
	and we expected to have to track what came from research, so we
	didn't want to sit down and rewrite it.
	d) All of this led to some necesary, but inelegant decisions, which
	is which I always preffered that it be called the PWB Shell...
The only true merits of this were:
	a) It helped get serious shell programming rolling.
	b) It supported a lot of the program administration and tool-building
	efforts of about a 1000 people at BTL-PY, and probably saved a lot of
	people a bit of time.
	c) Although much of its added syntax disappeared forever, some of the
	semantics led to cleaner features in later systems.
	d) It did generate a Bell Labs course called "Bourne Shell Programming
	for Mashey Shell Programmers", a maddening title if there was one....
-- 
-john mashey	DISCLAIMER: <generic disclaimer, I speak for me only, etc>
UUCP: 	{ames,decwrl,prls,pyramid}!mips!mash  OR  mash@mips.com
DDD:  	408-991-0253 or 408-720-1700, x253, or 408-524-7015
USPS: 	MIPS Computer Systems, 930 E. Arques, Sunnyvale, CA 94086