If someone could get donald trump to sell hair curlers, we might get the "curly boys"."CURL FIRST!"
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.
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.
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:
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.
There won't be any kind of braces as block markers, cause this is Pascal which uses words instead of symbols for such things.
Seriously, if someone loves curly brackets so much, they should program in C, all the curly brackets they can type.
Or GoLang...That one refuses to be called a C family member despite taking the basic block structure from it just because it's also inspired by Oberon (consequently, Pascal) for declaration sectioning, declaration order (identifier first, type later) and type bound procedures, perhaps also import aliasing.
The Arduino language (some kind of C I think) uses {} instead of Begin/ End. I still cannot get used to that.
To be honest, I don't see a reason why not to have some sort of "Cascal" project.
I think the major argument against that is the extent to which type checking etc. would have to be relaxed...why relax any pascal restriction?
Or GoLang...That one refuses to be called a C family member despite taking the basic block structure from it just because it's also inspired by Oberon (consequently, Pascal) for declaration sectioning, declaration order (identifier first, type later) and type bound procedures, perhaps also import aliasing.
To be honest, I don't see a reason why not to have some sort of "Cascal" project.
(yes, people will complain that copy-pasted C code doesn't compile in Cascal)
So in that time I was used "(*" and "*)" instead curly brackets. and "(." ".)" instead "[" "]"
But "(*" "*)" are still great for debugging, for example when you need to comment some code that already have comments with curly brackets.
When I was started learning Pascal (Turbo Pascal 3.0 for DOS) there is no curly brackets on my keyboard.
Fun fact: FPC handles the replacement for square brackets as well (and obviously the comment style):
When I was started learning Pascal (Turbo Pascal 3.0 for DOS) there is no curly brackets on my keyboard.It looks like we started learning Pascal around same time in the same country. :)
In that time curly brackets was replaced with local characters for my country so "{" was replaced with "Š"
and "}" was replaced with "Đ". :)
Fun fact: FPC handles the replacement for square brackets as well (and obviously the comment style):
Am I right in assuming that (* *) shouldn't be considered to be digraphs for { } since (* } and { *) don't work? My recollection is that some things are still picky about which form they use, e.g. macros requite breaces.
That is a feature so you can use style B to quickly comment blocks that contain comments in Style A.
It is a feature I regularly miss in C btw, or it is just my ignorance.
Fun fact: FPC handles the replacement for square brackets as well (and obviously the comment style):
Am I right in assuming that (* *) shouldn't be considered to be digraphs for { } since (* } and { *) don't work? My recollection is that some things are still picky about which form they use, e.g. macros requite breaces.
Am I right in assuming that (* *) shouldn't be considered to be digraphs for { } since (* } and { *) don't work? My recollection is that some things are still picky about which form they use, e.g. macros requite breaces.
As I have written in the comment of the example code, in trunk in mode ISO (and it should also be EXTENDEDPASCAL, but isn't :o ), it is indeed handled as a digraph. In the other modes this is not done due to Delphi- and nowadays also backwards compatibility.
As I have written in the comment of the example code, in trunk in mode ISO (and it should also be EXTENDEDPASCAL, but isn't :o ), it is indeed handled as a digraph. In the other modes this is not done due to Delphi- and nowadays also backwards compatibility.
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.
I think interesting the Ordered set vs unordered. Does the compiler does some distinction, reorder these by default or is it some kind of walkthrough about parallelisable syntax. I think the good idea of this suggestion is this point.