Re:Prefer the British Style of Quotation Mark Punctuation ov...
by ivan_gammel on Wednesday September 15, 2021 @06:17AM
(#28537342)
In fact in some programming languages you can (or should) omit things like this. E.g. pascal does not require or explicitly forbids semicolon before end keyword.
[ Parent
| on HN ]
Re:Prefer the British Style of Quotation Mark Punctuation ov...
by montroser on Wednesday September 15, 2021 @06:46AM
(#28537495)
See also automatic semicolon insertion in JavaScript, and conditional permission to omit closing <p> tags in HTML.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
https://html.spec.whatwg.org/multipage/grouping-content.html...
Re:Prefer the British Style of Quotation Mark Punctuation ov...
by int_19h on Wednesday September 15, 2021 @06:30AM
(#28537423)
Pascal is fully self-consistent here: in it, semicolon is a statement separator, not a statement terminator. Since the statement before "end" is the last one in the block, there's no statement to separate it from with a trailing semicolon, and so it's a syntax error.
Re:Prefer the British Style of Quotation Mark Punctuation ov...
by barrkel on Wednesday September 15, 2021 @08:45AM
(#28538390)
Pascal permits a null production for the statement grammar.
simple-statement =
empty-statement
| assignment-statement
| procedure-statement
| goto-statement .
empty-statement = .
from http://www.pascal-central.com/iso7185.html#6.8%20Statements (ISO 7185 Pascal)In practice the separator-vs-terminator distinction mostly shows up in if-statements:
if foo then
bar
else
baz;
I believe that anywhere else in a statement context, you can put in as many extra ';' as you like and it won't make a difference. And of course you can drop the final ';' before 'end' or 'until'.
Re:Prefer the British Style of Quotation Mark Punctuation ov...
by stkdump on Wednesday September 15, 2021 @07:21AM
(#28537697)
It's not a syntax error.
Re:Prefer the British Style of Quotation Mark Punctuation ov...
by denton-scratch on Wednesday September 15, 2021 @08:48AM
(#28538416)
Correct - the redundant semi-colon denotes an empty statement.
Re:Prefer the British Style of Quotation Mark Punctuation ov...
by ngcc_hk on Wednesday September 15, 2021 @06:39AM
(#28537468)
In those day when moving cursors with full screen editor (which is Not vi or Emacs), how many hours of my life wasted on this deletion of semicolons. Sigh.
Still I actually struggled each time this given not exactly sure I am in English or American camp.