From: Richard on 13 Apr 2010 01:32 On Apr 13, 1:24 am, Neville Dempsey <neville...(a)gmail.com> wrote: > On Apr 12, 9:47 am, Richard <rip...(a)Azonic.co.nz> wrote: > > > On Apr 10, 4:20 pm, Neville Dempsey <neville...(a)gmail.com> wrote: > > > On Apr 9, 11:45 am, Richard <rip...(a)Azonic.co.nz> wrote: > > As he says "not in any detail".Algol 68Rhas unions: > > > UNION(INT, CHAR) x; > > > where x may be freely assigned to as by an INT or a CHAR and coercion > > will set the type as appropriate, but there is no de-uniting coercion. > > > In C this would be specified as: > > > union x_tag { int xint ; char xchar; } x; > > > and it is necessary to refer to x.xint or x.xchar specifically. > > Indeed: putting values into an A68 union is automatic, but pulling > it out is awkward, eg: > > C union example: > union{int i; char c;} x; x.i=666; > printf("%3d\n",x.i); > > A68 union example: > UNION(INT, CHAR) x:=666; > printf(($3dl$, (x|(INT i):i) )) > > The net effect of "type-tagging" is that Algol68's strong typing > "half" encrouches into the union. > > > The only real similarity is the word 'union' because the syntax is > > quite different as well as the semantics. The actual context of > > declaring one area of memory as different types comes from assembler. > > Assembler? thats cool! In 1960s Fortran used EQUIVALENCE or > COMMON for memory sharing, I forget how PL/I & COBOL did this. COBOL has REDEFINES. Plus each level is an implicit redefine. > I'm not an assembler guy, does the UNION keyword appear in 1960's > assemblers? (ThanX) There is no need for it, union (or variations) is to defeat the type system. > > > Page: 5 More History > > > > > For example, B introduced generalized assignment operators, using > > > > x=+y to add y to x. The notation came fromAlgol 68[Wijngaarden > > > > 75] via McIlroy, who had incorporated it into his version of > > > > TMG. (In B and early C, the operator was spelled =+ instead of +=; > > > > this mistake, repaired in 1976, was induced by a seductively easy > > > > way of handling the first form in Bs lexical analyzer.) > > > Algol-68R has assignments: > > > x PLUS y x MINUS y x TIMES y x DIV y > > PLUS, MINUS, TIMES and DIV.... Almost looks like COBOL :-) > c.f.http://www.fh-jena.de/~kleine/history/languages/Algol68R-UserGuide.pdf > > ¢ I'm impressed... did you have a real copy on hand? :-) ¢ A real paper book, yes. Exactly that in the PDF. Plus a copy of ICL Technical sales Instruction No 1014 which relates to the product on ICL 1900. > These assignments were refered to as BOLD and can be found in > the "Unrevised Report" (Rev0) of ALGOL 68, and were equivalent > to A68's BRIEF/ASCII forms x:+=y, x-:=y, x*:=y and x/:=y; > > Further they are equivalent to modern C's x+=y, x-=y, x*=y and x/= > > BOLD versions are used on platforms with limited (6 bit) character > sets (and that might not have +,-,* or /) hence the expression > "REAL PROGRAMMERS THINK IN UPPER CASE". > > In Rev0 has the bonus PRUS assignment, equivalent to y +=: x > > (PLUS is for (L)eft assignment, PRUS is for (R)ight assignment, > eg: PRUS for prefixing to an existing string variable; and other > non commutative adds - A68 has user definable operators) > > Subsequently in the "Revised Report" (Rev1) of Algol 68 these > ASSIGNMENTS where renamed: PLUSAB, MINUSAB, TIMESAB and DIVAB > for +:=, -:=, *:= and %:= there PLUS, MINUS, TIMES became > DIADIC operators. > > In Rev1 PRUS becomes PLUSTO which has the "BRIEF" form y+=:x > eg, to suffix "substring" to the beginning of a variable try: > "substring" +=: str > > These "right" operators also are native to python, eg: __radd__, > __rsub__, __rmul__ and __rdiv__; Also __rdivmod__, __rfloordiv__ > > > Certainly features may be copied from many different languages. > > > ... > > > > Although we entertained occasional thoughts about implementing > > > > one of the major lan- guages of the time like Fortran, PL/I, or > > > >Algol 68, such a project seemed hopelessly large for our resources: > > > > much simpler and smaller tools were called for. All these languages > > > > influenced our work, but it was more fun to do things on our own. > > > I think that clearly says that C is not a derivative of Fortran, PL/I > > orAlgol-68. > > I think that clearly says that C is not an _implementation_ > of Fortran, PL/I or Algol-68. > > regs > NevilleD > -- > Linux's Algol68 Compiler, Interpreter & Runtime: > *http://sourceforge.net/projects/algol68
From: Neville Dempsey on 13 Apr 2010 04:47
On Apr 13, 3:32 pm, Richard <rip...(a)Azonic.co.nz> wrote: > On Apr 13, 1:24 am, Neville Dempsey <neville...(a)gmail.com> wrote: > > >Algol-68Rhas assignments: > > > > x PLUS y x MINUS y x TIMES y x DIV y > > > PLUS, MINUS, TIMES and DIV.... Almost looks like COBOL :-) > > c.f.http://www.fh-jena.de/~kleine/history/languages/Algol68R-UserGuide.pdf > > > ¢ I'm impressed... did you have a real copy on hand? :-) ¢ > > A real paper book, yes. Exactly that in the PDF. Plus a copy of ICL > Technical sales Instruction No 1014 which relates to the product on > ICL 1900. Hmmm... You have the Algol68R guide, all you need now it GEORGE3 OS & HW emulator and an Algol68R compiler... eg: http://sw.ccs.bcs.org/CCs/a68demo.zip [ p.s. Runs on wine ;-) ] enjoy NevilleDNZ -- Linux's Algol68 Compiler, Interpreter & Runtime: * http://sourceforge.net/projects/algol68 |