frank@sagan.UUCP (Frank Whaley) (09/16/85)
In article <163@unitek.uucp>, reid@unitek.uucp (Reid Spencer) responds: > Hey, don't get so down on yourself. I'm in favour of what you have > suggested. How about the following: > #define cycle for(;;) { > #define endcycle } > #define then { > #define otherwise } else { > #define elseif } else if > #define endif } > #define exitwhen(exp) if (exp) break; > #define exitunless(exp) if (!(exp)) break; > We can then write > cycle > exitwhen(cond1) > if (cond2) then > stuff1 > elseif (cond3) then > stuff2 > otherwise > stuff3 > endif > endcycle [ FLAME ON ] What language is this?? Surely not my old friend C. I have encountered this style of coding in the work of "professional" coders (note that I *did not* use the word "programmer":-). I found chasing the bugs to be similar to learning PL/I -- I had to re-educate my fingers in order to be able to manipulate these strange symbols. I hope that this sort of #define abuse is not being taught in the nation's educational establishments. I currently work within a team of 16 programmers who must be able to *understand*, not just read, each others work. Sometimes months pass between edits of a file. I have found that mandating only the barest minimum (K&R, Library Manual, the Mystical and Untouchable Header Files) is all that will be accepted with any semblance of agreement. I contend that (in a commercial environment) the #define command should only be used for constant and macro definitions, and any further use falls into the category of gratuitous tinkering. [ FLAME OFF ] On the other hand, I've used preprocessor #defines to prototype the syntax of another language, before I learned to yacc. -- frank ... Frank Whaley, MicroPro Product Development {dual,hplabs,glacier,lll-crg}!well!micropro!sagan!frank
ray@othervax.UUCP (Raymond D. Dunn) (09/18/85)
In article <137@sagan.UUCP> frank@sagan.UUCP (Frank Whaley) writes: >>..[In response to Algol like & other syntactic redifinitions] > >What language is this?? Surely not my old friend C. I have encountered this >style of coding in the work of "professional" coders (note that I *did not* >use the word "programmer":-). I found chasing the bugs to be similar to >learning PL/I -- I had to re-educate my fingers in order to be able to >manipulate these strange symbols. >.. etc The interesting thing here I think, is that discovering what: foo(bar,harry); does is regarded as a reasonable part of the debugging process, but: repeatuntil(1000) is not! I really believe the lines of distinction are very fuzzy, and probably fall into the same category as style preference - it's not re-educating your fingers that's the problem, its re-programming your pattern recognition system. I must admit that "bad" (my judgement) positioning of braces and "incorrect" indentation, distracts me much more than the use of "syntactic enhancements". Now, sigh, an inappropriately named variable or function can make me go way over the deep end, and comments which dont match the code - MY GOD! (For the argumentative - please note I said "distracts ME" not "is more distractive" (:-) - perhaps we should develop a net symbol to denote "this is only my opinion, used in my dealings with myself, and I am not trying to force it on you" - I wont suggest one, I'm sure there are some of you out there who may have some ideas (:-) - or would it make any difference? It would seem we have too many contributors who take it as a personal insult if others have different views, different lifestyles, different values, than theirs - including myself occasionally!) Note: this is not a flame at the poster of the above quote. Ray Dunn ..philabs!micomvax!othervax!ray