Without OTHER changes in parsing arithmetic expressions, that may or may not be warranted, just replacing the '=' being used for assignment with an arrow ELIMINATED that particular confusion.  Well, mostly.  You can't use a right pointing arrow to fix 3 = X

On Fri, 29 Jan 2021, ben via cctalk wrote:
Blame K&R with C with the '=' and '==' mess because assignment is a operation. I never hear that C or PASCAL have problems.

I think that it was Ritchie and Thompson who created C;
Kernighan and Ritchie documented it.

'=' and '==' makes possible what is probably the most common error, and which the compiler doesn't catch:
if (x = 3) . . .   /* sets x to 3 and gives TRUE for the condition */
I imagine that there are probably some pre-processors that would return a WARNING for it.

I find the pseudo code often less confusing than real languages.
the one I like best uses indentation for structure.
while k do
.if foo then
..do this thing
..do that thing
.else
..something here
.!end if
! end while
You COULD design a language around your favorite pseudo-code structures.


I like indentation, and demanded it from my students.
while (k)
{   if (foo)
    {  ..do this thing
       ..do that thing
    }
    else
    {  ..something here
    }
}

Even K and R did not agree on indentation styles.


--
Grumpy Ol' Fred                 ci...@xenosoft.com

Reply via email to