Hi, Scott,

This is an interesting point of view Marc, but I wonder if you are basing
your point of view on your knowledge of C.  Look at your example:

Yes, absolutely. I did not make that clear enough, sorry.
The basic for my "excurse" was, of course, that the "reader" (and the writer) of code is a developer, not a narrator. A developer will most likely be used to the standard term "++". That's the basic for me saying "it is clear".

Well, actually a "C/C++" developer. I learned to program in assember and in most assemeblers I've come across, the increment operation has a specific instruction, like so:


IAR  - Increment A-Register
INC  HL  - Inrement HL Register

I then learned Pascal and Basic and got used to this Syntax:

counter := counter + 1      Pascal
let counter = counter + 1  Baslc

I then moved onto C and the syntax:

counter++

Was not at all obvious to start with and so I used:

counter = counter + 1 Which worked just fine, until I looked at the assembler that was generated and found that it did something like this:

MOV  A,counter
ADD A,1
MOV counter,A

Instead of:

INC A

I would imagine that the ++ syntax came about for a number of reasons none of which has anything to do with clarity:

1. It was quicker to type counter++, and using a Teletype this was important.
2. It was quicker to print counter++ again using a Teletype at 33 BPS this was important.
3. It was easier for the code generator to substitute an "INC" operation when ++ was spotted and with limited memory and execution speed this was important.


All these issues are no more. To me the syntax

counter = counter + 1 or add 1 to counter is MUCH clearer, but in this case it really doesn't make any real difference. I really wouldn't mind if Transcript supported both syntax, but I would imagine that this would cause confusion for people that don't have a hard-core programming background, so it's better to just have one syntax, and the "add 1 to counter" seems the better choice.

Just my 5 cents worth, cos I'm waiting for a compile to finish!!

All the Best
Dave

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to