Polite Programming

September 20th, 2010| Posted by slembcke
Categories: Uncategorized | Tags:

Who says that you can’t be polite and proper even if you are a programmer?


#define please

int a = 5; please

int myFunction(){ return 5 please; }

if(error) abort please ();

  1. James McNeill
    September 22nd, 2010 at 18:16
    Reply | Quote | #1

    I know a programmer who did something like that when he first learned C. He was fond of the Pascal/Ada style, so he did this:

    #define then
    #define begin {
    #define end }

    Then he could write code in the style to which he was accustomed:

    if (a == b) then begin
    return true;
    end;

  2. Joe Lee
    September 24th, 2010 at 05:40
    Reply | Quote | #2

    INTERCAL, the original parody programming language, had an undocumented feature that a certain fraction of the statements had to contain the word “PLEASE” (something like between a fifth and a third of the statements). If the word didn’t appear frequently enough, the compiler rejected the program as insufficiently polite — and likewise if it appeared too frequently, which was considered to be grovelling.

    http://en.wikipedia.org/wiki/INTERCAL

    http://www.muppetlabs.com/~breadbox/intercal-man/

  3. Andy Korth
    September 27th, 2010 at 07:30
    Reply | Quote | #3

    Heh, yeah. That’s actually the discussion Scott and I had that brought up the idea of “please”.

Comments are closed.