jahboater
Posts: 4761
Joined: Wed Feb 04, 2015 6:38 pm

General language discussion.

Wed May 15, 2019 3:26 pm

There is a need here to discuss the history and merits of various programming languages.
The threads on BASIC keep getting derailed (me included).

If the mods don't mind, can I start a thread here to allow the posts that are considered off-topic to the xxxBASIC threads?

As long as politeness and respect prevail of course - which has been the case.

Random posts are OK, no particular topic "must" be strictly followed.

I'll start with Peter O's quote from Hoare about Algol 60.

That's a very famous post.
I loved Algol 60 and understand its underpinning of modern imperative languages.

But I liked Algol 68 better!
Flexible arrays, concurrent programming (parallel clauses), you name it!
I even used to read the infamous silver "Revised Report" at bedtime (that's sad).
Fortunately Denis Ritchie took the easy to implement Algol 68 stuff into C.

User avatar
PeterO
Posts: 5066
Joined: Sun Jul 22, 2012 4:14 pm

Re: General language discussion.

Wed May 15, 2019 3:56 pm

I may have posted this before :-)
My copy of the 803 ALGOL 60 manual is autographed :-)
PeterO
Attachments
803A104Sigs.jpeg
803A104Sigs.jpeg (46.96 KiB) Viewed 1917 times
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

ejolson
Posts: 3680
Joined: Tue Mar 18, 2014 11:47 am

Re: General language discussion.

Wed May 15, 2019 4:07 pm

PeterO wrote:
Wed May 15, 2019 3:56 pm
I may have posted this before :-)
My copy of the 803 ALGOL 60 manual is autographed :-)
PeterO
Woohoo! Nice memories. Stay tuned for an autographed (actually paw printed) version of FidoBasic with built-in big number support and n-level meta programming that is easier to use than closures.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23869
Joined: Sat Jul 30, 2011 7:41 pm

Re: General language discussion.

Wed May 15, 2019 4:41 pm

Have fun!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

jalih
Posts: 87
Joined: Mon Apr 15, 2019 3:54 pm

Re: General language discussion.

Wed May 15, 2019 5:31 pm

jahboater wrote:
Wed May 15, 2019 3:26 pm
There is a need here to discuss the history and merits of various programming languages.
As we talk about old programming languages, PL/I is really hard to beat. It was well ahead of it's time and still unparalled in many tasks.

Say you want to solve a Sudoku? On PL/I, you can present Sudoku board as:

Code: Select all

   /* Sudoku board presentation from the book: The New PL/I. */
   define alias bits bit(9) aligned;
   dcl total(81) type bits;
   dcl matrix(9, 9) type bits based(addr(total));
   dcl box(9, 3, 3) type bits defined (total(trunc((1sub-1) /3) * 27 + mod(1sub-1, 3) * 3 + (2sub-1) * 9 + 3sub));

   dcl posbit(0:9) type bits init('000000000'b, '100000000'b, '010000000'b, '001000000'b,
                                  '000100000'b, '000010000'b, '000001000'b, '000000100'b,
                                  '000000010'b, '000000001'b);
Now all you need to do to solve Sudoku is:

Code: Select all

   /*************************************/
   /* Simple recursive sudoku solver */
   /*************************************/
   solve: proc recursive returns(bit(1));
     dcl (i, j, k) fixed bin(31);
     dcl result type bits;

     /* find free cell */
     do i = 1 to 9;
       do j = 1 to 9;
         if matrix(i, j) = posbit(0) then goto skip;
       end;
     end;

     /* No more free cells. Check if the completed Sudoku is valid.      */
     /* Number in the cell is valid if the matching position bit is set. */
     do i = 1 to 9;
       do j = 1 to 9;
       k = index(matrix(i, j), '1'b);
       matrix(i, j) = posbit(0);
       result = ^(any(matrix(i, *)) | any(matrix(*, j)) | any(box(numbox(i, j), *, *)));
       if substr(result, k, 1) = '0'b then return('0'b);
       matrix(i, j) = posbit(k);
       end;
     end;

     return('1'b);
    skip:

     /* Go through and test possible values for the free cell untill the Sudoku is completed */
     result = ^(any(matrix(i, *)) | any(matrix(*, j)) | any(box(numbox(i, j), *, *)));
     k = 0;
     do forever;
       k = search(result, '1'b, k+1);
       if k = 0 then leave;
       matrix(i, j) = posbit(k);
       if solve() then return('1'b);
       else matrix(i, j) = posbit(0);
     end;

     return('0'b);
   end solve;


   /********************************************/
   /* Returns box number for the sudoku coords */
   /********************************************/
   numbox: proc(i, j) returns(fixed bin(31));
     dcl (i, j) fixed bin(31);

     dcl lookup(9, 9) fixed bin(31) static nonasgn init( (3)1, (3)2, (3)3,
                                                         (3)1, (3)2, (3)3,
                                                         (3)1, (3)2, (3)3,
                                                         (3)4, (3)5, (3)6,
                                                         (3)4, (3)5, (3)6,
                                                         (3)4, (3)5, (3)6,
                                                         (3)7, (3)8, (3)9,
                                                         (3)7, (3)8, (3)9,
                                                         (3)7, (3)8, (3)9 );

     return(lookup(i, j));
   end numbox;
I want to see C version that is simpler and easier to read...

User avatar
PeterO
Posts: 5066
Joined: Sun Jul 22, 2012 4:14 pm

Re: General language discussion.

Wed May 15, 2019 5:36 pm

That's only easy to read if you know what "dcl" means and "result = ^(any(matrix(i, *)) | any(matrix(*, j)) | any(box(numbox(i, j), *, *)));" is pretty much gobblygook to a non-PL/1 programmer :lol:

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Heater
Posts: 13598
Joined: Tue Jul 17, 2012 3:02 pm

Re: General language discussion.

Wed May 15, 2019 6:43 pm

PeterO,

That is quite a trophy you have there.

Tony Hoare has been in my personal hall of fame since I discovered he originated Communicating Sequential Processes (CSP) whilst I was getting to grips with Occam. Ideas implemented in languages in recent times with Go and XC from Xmos.
Memory in C++ is a leaky abstraction .

User avatar
PeterO
Posts: 5066
Joined: Sun Jul 22, 2012 4:14 pm

Re: General language discussion.

Wed May 15, 2019 6:53 pm

It's worth noting that most of the manuals for the 803 software library that was supplied by Elliotts contain credits for the authors, unlike today where manuals tend to be anonymous. Consequently I have the manual for the "shell sort" library function that was also written by Tony Hoare before he came up with the idea for quicksort. This is mentioned in "The emperor's old clothes".

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Heater
Posts: 13598
Joined: Tue Jul 17, 2012 3:02 pm

Re: General language discussion.

Wed May 15, 2019 6:55 pm

The Soduku solver in C here is a little longer https://codereview.stackexchange.com/qu ... olver-in-c
Probably not much in it from an expressiveness perspective.

I'm amazed to see PL/I code here, jalih, another language I have never seen used anywhere. Although I did meet a PL/I programmer in 1984 or abouts.

Do you think you could make a million digit Fibonacci number calculator with PL/1. That would make a great entry to the fibo(4784969) challenge: https://github.com/ZiCog/fibo_4784969

How on Earth would we run it? And on a Pi?
Memory in C++ is a leaky abstraction .

User avatar
John_Spikowski
Posts: 1495
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: General language discussion.

Wed May 15, 2019 9:28 pm

Is there any way to find out what language is used most with the RPi? I'm guessing it's Python but would like to know how C ranks among this group.

jahboater
Posts: 4761
Joined: Wed Feb 04, 2015 6:38 pm

Re: General language discussion.

Wed May 15, 2019 9:55 pm

You could look at the number of topics in the programming section of this forum?

Python 9364
C/C++ 3108

but maybe that's related to the number of people with actual problems rather than the number of users.

Both languages are included within the Rasbian image. so you cant count the number of downloads.

User avatar
John_Spikowski
Posts: 1495
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: General language discussion.

Wed May 15, 2019 10:01 pm

What type of programming projects are most popular on the RPi?

echmain
Posts: 239
Joined: Fri Mar 04, 2016 8:26 pm

Re: General language discussion.

Wed May 15, 2019 10:25 pm

Does anyone remember a language called APL?

You needed a special keyboard for its goofy character set and it had operators with names like “quote quad”.

I learned it as a Computer Science student at Michigan State University in 1980...and I’ve never seen it since.

You could do some insanely powerful stuff with mathematics and arrays though, with just a few characters.

PhatFil
Posts: 1406
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: General language discussion.

Wed May 15, 2019 10:45 pm

Before all this gui nonsense I was mumps aka M systems programmer using a single data type (string) a single data structure (sparse array ?b2 tree?) with a handful of system services (time $H, array traversal $O) and 12x iirc commands all of which can be reduced to a single letter abbreviation, "I" for IF "Q" for Quit etc.. And source code for a complete hospital PAS (patient administration system) with 800+ terminal clients local and remote satellite clinics could fit on a couple of hd floppy disks. Migrating off Sequent/Unix to MS Windows resulted in a 5x cd installation set for the same system (operation/feature wise).

The last page of the monthly DataTree Journal always contained an entertaining implementation of an algorithm in M using only the conditional and terminal Quit commands .


Simpler Times (sigh!!)

User avatar
John_Spikowski
Posts: 1495
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: General language discussion.

Wed May 15, 2019 11:11 pm

I started programming for a living with REXON Business BASIC (RECAP). It was a OS and BASIC in one.

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: General language discussion.

Thu May 16, 2019 12:48 am

ScriptBasic wrote:
Wed May 15, 2019 9:28 pm
Is there any way to find out what language is used most with the RPi? I'm guessing it's Python but would like to know how C ranks among this group.
Probably impossible to ever know. The Pi had a mission of educating and teaching computing so naturally has a large student and hobbyist user base, that mission then extended to enabling digital making, and makers were in on the game from the start. Half of all Pi's sold are said to have gone to industrial users.

We can perhaps dismiss that industrial half because they'll likely be using far more Pi than than programs written. We could likely dismiss a good chunk of the rest as being used as media centres, console emulators, NAS's, access points, PiHoles, and in other roles where there's no actual programming involved.

I would imagine Scratch is popular with many students, but we don't know the demographics using Pi's, what they are being used for, or how.

User avatar
John_Spikowski
Posts: 1495
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: General language discussion.

Thu May 16, 2019 1:15 am

Do you think home automation is hot with the RPi?

Andyroo

Re: General language discussion.

Thu May 16, 2019 1:36 am

ScriptBasic wrote:
Thu May 16, 2019 1:15 am
Do you think home automation is hot with the RPi?
Yes but I would start a new thread for that discussion and keep this to languages :D

User avatar
John_Spikowski
Posts: 1495
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: General language discussion.

Thu May 16, 2019 1:52 am

I'm trying to find the sweet spot for ScriptBasic so I know where to spend my time.

User avatar
Gavinmc42
Posts: 3878
Joined: Wed Aug 28, 2013 3:31 am

Re: General language discussion.

Thu May 16, 2019 1:55 am

There is a need here to discuss the history and merits of various programming languages.
Why?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Heater
Posts: 13598
Joined: Tue Jul 17, 2012 3:02 pm

Re: General language discussion.

Thu May 16, 2019 4:25 am

Because it's fascinating and educational.
Memory in C++ is a leaky abstraction .

User avatar
John_Spikowski
Posts: 1495
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: General language discussion.

Thu May 16, 2019 4:39 am

Heater wrote:
Thu May 16, 2019 4:25 am
Because it's fascinating and educational.
Does that mean this is going to become a tutorial thread about obscure languages?

I think it would be more interesting if people would share what they dislike about popular languages. It could save others going through the same frustration.

User avatar
John_Spikowski
Posts: 1495
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: General language discussion.

Thu May 16, 2019 5:11 am

Let me start off.

I dislike the ridged formatting requirements of Python. It's tough enough getting your own code to run to be dinged by an indentation mistake.

Is that a pain point you just learn to live with?

How do Python users know an extension is available for what they just wrote natively?

Heater
Posts: 13598
Joined: Tue Jul 17, 2012 3:02 pm

Re: General language discussion.

Thu May 16, 2019 5:34 am

I'm not sure focusing on dislikes is going to be very productive. We all have dislikes, often for quite emotional rather than technical reasons. It could just lead to the typical language war mud slinging one see all over the net.

Modern programming languages support a mash up of concepts about programming and structuring programs that took some time to evolve. Examples are: structured loops and conditionals, functions, procedures, recursion, indirection (pointers, references), first class functions, higher order functions, closures, events, classes/objects, coroutines, CSP etc, etc, etc.

For example modern BASIC have implemented a lot of the features originally seen in the mother of all languages ALGOL: Structured loops, functions etc. Sometimes even classes and objects. I don't think I have seen a BASIC that supports lambdas and closures or higher order functions

Or modern C++, which is only recently getting support for features like lambdas and closures. Which have been in other languages for decades.

I find it fascinating to discover where these ideas originated from. Who thought it up and why. What problem is it supposed to solve etc... How do the fit with other concepts supported by the language etc.
Memory in C++ is a leaky abstraction .

User avatar
John_Spikowski
Posts: 1495
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: General language discussion.

Thu May 16, 2019 5:55 am

No one owns the languages but are just users. There is nothing to protect or defend.

Just because someone says they like a feature of some language doesn't make them biased.

Return to “Other programming languages”