Re: Square Brackets

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Thu, 15 Nov 2007 08:56:29 +0000 (UTC), Erland Sommarskog
<esquel@xxxxxxxxxxxxx> wrote:

Maciek Sarnowicz [MSFT] (macies@xxxxxxxxxxxxxxxxxxxx) writes:
Could you share some reasons why the square brackets are not welcome?

They add noise and makes code more difficult to read.

Actually, I think there should be three options:

o Always square brackets.
o Square brackets when needed.
o Never square brackets.

Roy seemed to prefer the latter, to catch badly named objects. But it
might be necessary with this option to make an exception: if you script
a table or an index is included, in most of the name the location is
PRIMARY which in this is context is a an identifier and not a keyword.

I would be VERY happy with "Square brackets when needed." That would
be optimal, even for me! 8-)

And let us not forget the one keyword in square brackets problem that
can not always be avoided: ON [PRIMARY] in a CREATE TABLE script. Of
course Microsoft were the ones that used the keyword in this case.
That would be a clear case where "as needed" is needed.

Roy Harvey
Beacon Falls, CT
.



Relevant Pages

  • Re: What about [Assembly]?
    ... Just to explain the reasoning behind the other posters perfectly correct ... the square brackets([]) in VB are there to mark the keyword ... 'Assembly' as not a keyword, to achieve the same thing(although you don't ...
    (microsoft.public.dotnet.languages.csharp)
  • re:square bracket in variable declarations
    ... The square brackets indicate that the contents are a keyword in VB, ... "String", but I have yet to find a reason for doing that. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: What is [Next]
    ... The use of Brackets lets you use a keyword as a variable name... ... > It is unsearchable in both google and msdn due to the ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Negate a regular expression
    ... square brackets are a character class. ... combination of 'y' or 'yes' will cause the script to exit. ... So having the regex look also for whitespace characters will ...
    (perl.beginners)
  • Re: Negate a regular expression
    ... square brackets are a character class. ... combination of 'y' or 'yes' will cause the script to exit. ... So having the regex look also for whitespace characters will ...
    (perl.beginners)