On Friday, 12 August 2016 at 17:53:12 UTC, ag0aep6g wrote:
On 08/12/2016 07:33 PM, Cauterite wrote:
Why would I not terminate a declaration with a semi-colon?
Why should a declaration not end in a semi-colon just because
the last
token is a brace?
Why should I not tell the lexer precisely where my declaration
ends
instead of relying on whatever other tokens floating around it
not
interfering?
The semicolon is just noise. You're not helping the lexer at
all. It goes by the braces, and doesn't see the semicolon as
belonging to the function declaration. The semicolon creates
another, empty declaration.
Then it should error if it doesn't accept ';'. If it accepts it
then it is legal. Your post is noise since it also is relatively
meaningless and just takes up space. Why is it no ok for him to
add a noisy ';' but it is ok for you to add noise to noise by
adding a noisy post?
This is accepted as well, and means the same:
----
;;;
void main() {}
;;;
----
Why must every thread in this forum contain more posts
regarding some
irrelevant tangent than posts responding to the original topic?
This is a common mistake - more for structs, though, because of
C syntax. So I point it out so that you can learn that there's
no point to it in D, and so that others don't get the
impression that it's the proper syntax.
It is not a mistake... only in your mind. If it was a mistake D
wouldn't allow it. Somewhere you picked up the mistake that
adding a semicolon to the end of a struct is a mistake. Maybe you
should unlearn that mistake?
There is no point in a lot of things, but pretending that life
depends on such trivial things is a much worse mistake, IMO.