The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Documentation on B language?
@ 2016-03-08 13:01 Doug McIlroy
  2016-03-08 18:00 ` John Cowan
  0 siblings, 1 reply; 14+ messages in thread
From: Doug McIlroy @ 2016-03-08 13:01 UTC (permalink / raw)


>> https://www.bell-labs.com/usr/dmr/www/kbman.html
>> https://www.bell-labs.com/usr/dmr/www/bintro.html

> Yup, there certainly were different versions of B.

Yes, kbman covers only one of the two implementations that
cohabited the PDP-11. The other was the same language, with
software paging, so it could have a larger data space.

Various aspects of the language were borrowed from PL/I,
BCPL and Algol 68. ++ and -- were novel operators. The
reversal of Algol's assignment operators (e.g. -=
became =-) was eventually repealed in C.

doug
e


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
  2016-03-08 13:01 [TUHS] Documentation on B language? Doug McIlroy
@ 2016-03-08 18:00 ` John Cowan
  2016-03-08 19:10   ` Andru Luvisi
  2016-03-09 11:09   ` Christian Neukirchen
  0 siblings, 2 replies; 14+ messages in thread
From: John Cowan @ 2016-03-08 18:00 UTC (permalink / raw)


Doug McIlroy scripsit:

> Various aspects of the language were borrowed from PL/I, BCPL and Algol
> 68. ++ and -- were novel operators. The reversal of Algol's assignment
> operators (e.g. -= became =-) was eventually repealed in C.

Algol 68, like Algol 60 and Pascal, used := (pronounced "becomes") for
assignment, and the Algol 68 assignment operators were spelled :+=,
:-=, etc. (pronounced "plus and becomes", "minus and becomes", etc.)
Pre-increment operators were already known in Lisp 1.5 long before;
they are now spelled incf and decf in Common Lisp.

-- 
John Cowan          http://www.ccil.org/~cowan        cowan at ccil.org
If I have not seen as far as others, it is because giants were standing
on my shoulders.  --Hal Abelson


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
  2016-03-08 18:00 ` John Cowan
@ 2016-03-08 19:10   ` Andru Luvisi
  2016-03-08 19:43     ` John Cowan
  2016-03-09 11:09   ` Christian Neukirchen
  1 sibling, 1 reply; 14+ messages in thread
From: Andru Luvisi @ 2016-03-08 19:10 UTC (permalink / raw)


How were they spelled in Lisp 1.5? The manual lists add1 and sub1, but says
nothing about them modifying the value of a variable.

Sent from my phone.  Please excuse my brevity.
On Mar 8, 2016 10:20 AM, "John Cowan" <cowan at mercury.ccil.org> wrote:

> Doug McIlroy scripsit:
>
> > Various aspects of the language were borrowed from PL/I, BCPL and Algol
> > 68. ++ and -- were novel operators. The reversal of Algol's assignment
> > operators (e.g. -= became =-) was eventually repealed in C.
>
> Algol 68, like Algol 60 and Pascal, used := (pronounced "becomes") for
> assignment, and the Algol 68 assignment operators were spelled :+=,
> :-=, etc. (pronounced "plus and becomes", "minus and becomes", etc.)
> Pre-increment operators were already known in Lisp 1.5 long before;
> they are now spelled incf and decf in Common Lisp.
>
> --
> John Cowan          http://www.ccil.org/~cowan        cowan at ccil.org
> If I have not seen as far as others, it is because giants were standing
> on my shoulders.  --Hal Abelson
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20160308/598b2f1b/attachment.html>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
  2016-03-08 19:10   ` Andru Luvisi
@ 2016-03-08 19:43     ` John Cowan
  2016-03-08 23:13       ` Tim Bradshaw
  0 siblings, 1 reply; 14+ messages in thread
From: John Cowan @ 2016-03-08 19:43 UTC (permalink / raw)


Andru Luvisi scripsit:

> How were they spelled in Lisp 1.5? The manual lists add1 and sub1, but says
> nothing about them modifying the value of a variable.

They may not have been in the very earliest 1.5, but rather in one of the
many 1.5 and 1.6 offshoots (which are documented mostly, if at all,
in unsearchable PDFs), probably spelled inc and dec.  The add1 and sub1
functions (later spelled 1+ and 1-) have always been pure functional.

-- 
John Cowan          http://www.ccil.org/~cowan        cowan at ccil.org
One Word to write them all / One Access to find them,
One Excel to count them all / And thus to Windows bind them.
                --Mike Champion


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
  2016-03-08 19:43     ` John Cowan
@ 2016-03-08 23:13       ` Tim Bradshaw
  0 siblings, 0 replies; 14+ messages in thread
From: Tim Bradshaw @ 2016-03-08 23:13 UTC (permalink / raw)


> On 8 Mar 2016, at 19:43, John Cowan <cowan at mercury.ccil.org> wrote:
> 
> They may not have been in the very earliest 1.5, but rather in one of the
> many 1.5 and 1.6 offshoots (which are documented mostly, if at all,
> in unsearchable PDFs), probably spelled inc and dec.

I am reasonably sure that they weren't in MACLISP (SETF is there) and fairly sure also they were not in InterLisp.  They do appear in Lisp Machine Lisp, so I would suspect that this was how they found their way into CL.

However as soon as macros appeared (sometime shortly after Lisp 1.5 I think) things like this become so easy to implement (in the usual cases at least: fully-fledged ones are harder until SETF and its machinery exists, although that itself can be implemented with macrology) that probably they appeared many times in programs informally before this without anyone bothering to document them.

--tim


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
  2016-03-08 18:00 ` John Cowan
  2016-03-08 19:10   ` Andru Luvisi
@ 2016-03-09 11:09   ` Christian Neukirchen
  2016-03-09 11:29     ` Brantley Coile
  1 sibling, 1 reply; 14+ messages in thread
From: Christian Neukirchen @ 2016-03-09 11:09 UTC (permalink / raw)


John Cowan <cowan at mercury.ccil.org> writes:

> Doug McIlroy scripsit:
>
>> Various aspects of the language were borrowed from PL/I, BCPL and Algol
>> 68. ++ and -- were novel operators. The reversal of Algol's assignment
>> operators (e.g. -= became =-) was eventually repealed in C.
>
> Algol 68, like Algol 60 and Pascal, used := (pronounced "becomes") for
> assignment, and the Algol 68 assignment operators were spelled :+=,
> :-=, etc. (pronounced "plus and becomes", "minus and becomes", etc.)

My copy of the Algol 68 report says "+:=" and "-:=", so it is
questionable why Ken reversed them, especially since the ambiguity
looks obvious.

> Pre-increment operators were already known in Lisp 1.5 long before;
> they are now spelled incf and decf in Common Lisp.

AFAICS Algol didn't have them, but every Pascal I know had inc and dec.

-- 
Christian Neukirchen  <chneukirchen at gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
  2016-03-09 11:09   ` Christian Neukirchen
@ 2016-03-09 11:29     ` Brantley Coile
  0 siblings, 0 replies; 14+ messages in thread
From: Brantley Coile @ 2016-03-09 11:29 UTC (permalink / raw)


Note that the novelty isn't that it adds or subtracts one with storage, but that it can be used in a more complex expression, along with a pre- and post-evaluation semantics. 

Also, Pascal post dates B. 

I offer this just as a clarification of the facts. I greatly admire both the languages of Thompson and Ritchie and those of Prof Wirth. I write a good bit of C code but all things being equal I would be programming in Oberon. But B's ++ and -- operators seem to be unique. 

Sent from my iPad

> On Mar 9, 2016, at 6:09 AM, Christian Neukirchen <chneukirchen at gmail.com> wrote:
> 
> John Cowan <cowan at mercury.ccil.org> writes:
> 
>> Doug McIlroy scripsit:
>> 
>>> Various aspects of the language were borrowed from PL/I, BCPL and Algol
>>> 68. ++ and -- were novel operators. The reversal of Algol's assignment
>>> operators (e.g. -= became =-) was eventually repealed in C.
>> 
>> Algol 68, like Algol 60 and Pascal, used := (pronounced "becomes") for
>> assignment, and the Algol 68 assignment operators were spelled :+=,
>> :-=, etc. (pronounced "plus and becomes", "minus and becomes", etc.)
> 
> My copy of the Algol 68 report says "+:=" and "-:=", so it is
> questionable why Ken reversed them, especially since the ambiguity
> looks obvious.
> 
>> Pre-increment operators were already known in Lisp 1.5 long before;
>> they are now spelled incf and decf in Common Lisp.
> 
> AFAICS Algol didn't have them, but every Pascal I know had inc and dec.
> 
> -- 
> Christian Neukirchen  <chneukirchen at gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
  2016-03-09 21:43 ` John Cowan
@ 2016-03-10 18:09   ` scj
  0 siblings, 0 replies; 14+ messages in thread
From: scj @ 2016-03-10 18:09 UTC (permalink / raw)


From the standpoint of a compiler writer, the increment operators (and
later, similar operators like &=) were surprisingly painful, on two
levels.

The first problem is that there were lots of nasty interactions between
these operators and function calls.  Consider gems like:
     f( ++i, ++i );
     f( ++i, i++ );
     f( i++, ++i );
     f( i++, i++ );
The "natural" behavior depended critically on whether the stack grew
upwards or downwards.  Add to this the delights that arose if i was an
external variable that was also referenced (or changed) within f.  This
may seem like an unlikely event, but it happened all time when the macro
implementation of getchar was introduced.

The second problem was that most victims of the above had a lot of
difficulty, at least the first time, in understanding what the bug was and
tracking it down...  And many considered the behavior they saw a compiler
bug (no mater what the documentation and/or the Standard said about
"undefined")...





^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
  2016-03-09 21:34 Doug McIlroy
@ 2016-03-09 21:43 ` John Cowan
  2016-03-10 18:09   ` scj
  0 siblings, 1 reply; 14+ messages in thread
From: John Cowan @ 2016-03-09 21:43 UTC (permalink / raw)


Doug McIlroy scripsit:

> According to Ken, the inspiration for ++ and -- came from the PDP-7
> hardware, not from previous languages.  The PDP-7 supported only ++i,
> where i had to be one of only a few memory addresses. "For symmetry",
> Ken says, he put all four operations in B. (And he did not use the
> hardware autoincrement.)

On the 12-bit PDP-8, the relevant addresses were 0010-0017; any indirect
reference through any such location was automatically preincremented.
However, they were hard to use in libraries, because allocation of this
incredibly scarce resource had to be manually managed, which meant in
effect that only the main program could use any of them, and because
PDP-8 programmers weren't in the habit of using them, they often were
simply ignored.  It was easy enough to add an extra ISZ (increment and
skip if zero) operation before the indirection.

-- 
John Cowan          http://www.ccil.org/~cowan        cowan at ccil.org
Wer es in kleinen Dingen mit der Wahrheit nicht ernst nimmt, dem kann
man auch in grossen Dingen nicht vertrauen.  --Albert Einstein on honesty


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
@ 2016-03-09 21:34 Doug McIlroy
  2016-03-09 21:43 ` John Cowan
  0 siblings, 1 reply; 14+ messages in thread
From: Doug McIlroy @ 2016-03-09 21:34 UTC (permalink / raw)


According to Ken, the inspiration for ++ and -- came 
from the PDP-7 hardware, not from previous languages.
The PDP-7 supported only ++i, where i had to be one
of only a few memory addresses. "For symmetry", Ken
says, he put all four operations in B. (And he did
not use the hardware autoincrement.)
Doug


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
@ 2016-03-09 12:34 Noel Chiappa
  0 siblings, 0 replies; 14+ messages in thread
From: Noel Chiappa @ 2016-03-09 12:34 UTC (permalink / raw)


    > From: Brantley Coile

    > But B's ++ and -- operators seem to be unique.

B seems to be like UNIX itself in this regard: a carefully selected set of
old ideas, along with a few new ones of equal value.

	Noel


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
  2016-03-07  0:57 Norman Wilson
@ 2016-03-07  8:39 ` Angelo Papenhoff
  0 siblings, 0 replies; 14+ messages in thread
From: Angelo Papenhoff @ 2016-03-07  8:39 UTC (permalink / raw)


On 2016-03-07 01:57, Norman Wilson wrote:
> Some starting points on B:
> 
> https://www.bell-labs.com/usr/dmr/www/kbman.html
> https://www.bell-labs.com/usr/dmr/www/bintro.html
> 
> Probably not exactly the PDP-7 edition, but near enough for reading
> at least.

Yup, there certainly were different versions of B. I noticed when I 
implemented a B compiler a few years ago:
https://github.com/aap/abc
(warning: generates very bad x86 assembly)



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS]  Documentation on B language?
@ 2016-03-07  0:57 Norman Wilson
  2016-03-07  8:39 ` Angelo Papenhoff
  0 siblings, 1 reply; 14+ messages in thread
From: Norman Wilson @ 2016-03-07  0:57 UTC (permalink / raw)


Some starting points on B:

https://www.bell-labs.com/usr/dmr/www/kbman.html
https://www.bell-labs.com/usr/dmr/www/bintro.html

Probably not exactly the PDP-7 edition, but near enough for reading
at least.

Norman Wilson
Toronto ON


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [TUHS] Documentation on B language?
@ 2016-03-07  0:20 Warren Toomey
  0 siblings, 0 replies; 14+ messages in thread
From: Warren Toomey @ 2016-03-07  0:20 UTC (permalink / raw)


So the PDP-7 code from Norman has a B interpreter. I know the history:
BCPL -> B -> NB -> C, but I don't recall seeing a decent decription of
the B language. Does anybody know of such a document? We'll need something
like this so we can use the interpreter once we get it working :-)

Cheers, Warren


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-03-10 18:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-08 13:01 [TUHS] Documentation on B language? Doug McIlroy
2016-03-08 18:00 ` John Cowan
2016-03-08 19:10   ` Andru Luvisi
2016-03-08 19:43     ` John Cowan
2016-03-08 23:13       ` Tim Bradshaw
2016-03-09 11:09   ` Christian Neukirchen
2016-03-09 11:29     ` Brantley Coile
  -- strict thread matches above, loose matches on Subject: below --
2016-03-09 21:34 Doug McIlroy
2016-03-09 21:43 ` John Cowan
2016-03-10 18:09   ` scj
2016-03-09 12:34 Noel Chiappa
2016-03-07  0:57 Norman Wilson
2016-03-07  8:39 ` Angelo Papenhoff
2016-03-07  0:20 Warren Toomey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).