Honest question: why begin and end and not { }?

Go down

Honest question: why begin and end and not { }?

· #1

I'm new here and I come in peace.

In every language I've used, a block is { and }. Two characters. Here it is begin and end, which is eight. Is there a reason, or is it tradition?

I'm asking sincerely. Please don't lock me.

Re: Honest question: why begin and end and not { }?

· #2

A reason: you can read it out loud.

pascal
if Ready then
begin
  Start;
  Report;
end;

Say that on the phone to a colleague. Now say this one:

c
if (ready) {
  start();
  report();
}

"Open paren ready close paren open curly." We are not animals.

Re: Honest question: why begin and end and not { }?

· #3

Also, in Pascal { and } already have a job. They are comments.

pascal
{ this whole line is a comment }

So when a C programmer pastes code in here, the compiler reads their entire function as one long thoughtful remark and compiles nothing. I find that poetic.

Pete · thirty years of begin and end "It compiled on my machine."

Re: Honest question: why begin and end and not { }?

· #4

The real argument nobody makes: end tells you a block closed. } tells you something closed. I have spent hours of my life counting } with my finger on the screen.

begin / end { / }
Characters typed 8 2
Readable aloud yes no
Finger-counting required rarely weekly
Already means "comment" here no yes
Starts arguments yes yes

Re: Honest question: why begin and end and not { }?

· #5

i use { } in pascal and it compiles fine

Re: Honest question: why begin and end and not { }?

· #6

It compiles because the compiler believes your code is a comment. Does the program do anything?

Read the error message. Then read it again.

Re: Honest question: why begin and end and not { }?

· #7

no. i thought that was a different bug

Re: Honest question: why begin and end and not { }?

· #8

BEGIN AND END ARE BETTER BECAUSE THEY ARE EASIER TO TYPE IN CAPITALS

sorry. but i stand by it

SORRY ABOUT THE CAPS

Re: Honest question: why begin and end and not { }?

· #9

Thank you all. I'm convinced, mostly by the phone argument and slightly by fear.

Re: Honest question: why begin and end and not { }?

· #10

This was the politest braces thread in the history of the internet. I had my hand on the lock the whole time and never needed it. I'm almost disappointed.

Forum rules 1 to 10 apply. Yes, to you.

Go up

Sign in to reply