Forum > Suggestions

A modest proposal in response to those who want "curly brackets"

(1/6) > >>

MarkMLl:
It seems that hardly a month can pass before somebody, almost always a newcomer to the forum and frequently a newcomer to Pascal, makes the earnest suggestion that the language would be improved if instead of having begin and end tokens Pascal adopted braces ("curly brackets") to delimit a block.

If I comment to this I usually point out that as well as being a long-accepted comment marker in Pascal, the closely-related language Modula-2 uses braces to delimit sets, and since much of the syntax of Object Pascal (i.e. the post Jensen & Wirth dialect) resembles Modula-2 it would make sense to reserve the option to use Modula-2 style sets etc. at some point in the future.

A literal set delimited by braces is unordered, i.e. the two sets {'a', 'b', 'c'} and {'a', 'c', 'b'} are indistinguishable from the POV of the language. Taking that into consideration, using braces to delimit a code block would appear to be particularly inappropriate, since the whole point of a code block is that the statements it encloses are executed in an ordered fashion.

I would propose instead that rather than using braces { } to delimit a code block, it would be more appropriate to use (square) brackets [ ]. I believe that there are a number of plausible arguments in this suggestion's favour:

* Among ALGOL-derived languages, square brackets are universally understood to represent array indexes which are by their nature ordered.

* Square brackets were adopted as block delimiters by Smalltalk in 1970. As such this usage predates C (1972) and is roughly contemporaneous with B and BCPL.

* I believe that this suggestion would be compatible with Pascal's existing syntax.

If this suggestion were adopted, and if a later variant of Pascal adopted the Modula-2 convention of using braces { } to identify an (unordered) literal set, it might also be possible to use braces to identify a group of statements that could be parallelised or at least reordered subject to dataflow dependencies by the compiler.

MarkMLl

440bx:
I find the fixation some people have with curly brackets a bit peculiar but, I suggest a compromise.  Those who want curly brackets should purchase a hair curler and curl their hair before writing code.  That way they get their "curl fix" and might be more inclined to leave the Pascal language alone.

If someone could get donald trump to sell hair curlers, we might get the "curly boys".

Seriously, if someone loves curly brackets so much, they should program in C, all the curly brackets they can type. 

Zvoni:

--- Quote from: 440bx on February 01, 2021, 11:23:12 am ---If someone could get donald trump to sell hair curlers, we might get the "curly boys".

--- End quote ---
"CURL FIRST!"

Nevermind, that it would be a "fake implementation" like everything else in Donnie's Life.....

marcov:

--- Quote from: MarkMLl on February 01, 2021, 10:16:43 am ---It seems that hardly a month can pass before somebody, almost always a newcomer to the forum and frequently a newcomer to Pascal, makes the earnest suggestion that the language would be improved if instead of having begin and end tokens Pascal adopted braces ("curly brackets") to delimit a block.

--- End quote ---

Yes.


--- Quote ---since much of the syntax of Object Pascal (i.e. the post Jensen & Wirth dialect) resembles Modula-2 it would make sense to reserve the option to use Modula-2 style sets etc. at some point in the future.

--- End quote ---

It is already reserved for comments.

PascalDragon:

--- Quote from: MarkMLl on February 01, 2021, 10:16:43 am ---I would propose instead that rather than using braces { } to delimit a code block, it would be more appropriate to use (square) brackets [ ]. I believe that there are a number of plausible arguments in this suggestion's favour:
--- End quote ---

You do notice that by suggesting an alternate, you're essentially starting the absolute same discussion that's involved with the usual suggestion just with a bit of different flavoring?


--- Quote from: MarkMLl on February 01, 2021, 10:16:43 am ---If this suggestion were adopted, and if a later variant of Pascal adopted the Modula-2 convention of using braces { } to identify an (unordered) literal set, it might also be possible to use braces to identify a group of statements that could be parallelised or at least reordered subject to dataflow dependencies by the compiler.
--- End quote ---

There won't be any kind of braces as block markers, cause this is Pascal which uses words instead of symbols for such things.

Navigation

[0] Message Index

[#] Next page

Go to full version