CLS compliant names

  • Thread starter Thread starter Edward Diener
  • Start date Start date
E

Edward Diener

Does anyone know the correct naming conventions for CLS compliant code ?
The doc points to a really obscure and difficult to digest document on
the web about Unicode names, and I am looking for simpler rules that
tell me what names are CLS compliant. Here are some simple questions:

1) Can a CLS compliant name start with an underscore ?
2) Is there a limit to the length of a CLS complaint name ? With a full
namespace name ?
 
Edward Diener said:
Does anyone know the correct naming conventions for CLS compliant code ?
The doc points to a really obscure and difficult to digest document on
the web about Unicode names, and I am looking for simpler rules that
tell me what names are CLS compliant. Here are some simple questions:
According to msdn,
CLS-compliant language compilers must follow the rules of Annex 7 of
Technical Report 15 of the Unicode Standard 3.0, which governs the set of
characters that can start and be included in identifiers. This standard is
available at www.unicode.org/unicode/reports/tr15/tr15-18.html.
For two identifiers to be considered distinct, they must differ by more than
just their case.

from Unicode Standard 3.0 Technical Report 15, Annex 7:

That is, the first character of an identifier can be an uppercase letter,
lowercase letter, titlecase letter, modifier letter, other letter, or letter
number. The subsequent characters of an identifier can be any of those, plus
non-spacing marks, spacing combining marks, decimal numbers, connector
punctuations, and formatting codes (such as right-left-mark). Normally the
formatting codes should be filtered out before storing or comparing
identifiers.
1) Can a CLS compliant name start with an underscore ?
From my reading of the above quotes, no.
2) Is there a limit to the length of a CLS complaint name ? With a full
namespace name ?
Let me dig into the ecma spec to see if anything exists, I can post back
about that later.
 
Daniel said:
According to msdn,
CLS-compliant language compilers must follow the rules of Annex 7 of
Technical Report 15 of the Unicode Standard 3.0, which governs the
set of characters that can start and be included in identifiers. This
standard is available at
www.unicode.org/unicode/reports/tr15/tr15-18.html.

That's the doc which I refer to above as obscure and difficult to digest.
Making my way through it and trying to understand its terminology, was a
real PITA for me.
For two identifiers to be considered distinct, they must differ by
more than just their case.

I had known this from MSDN, thanks !
from Unicode Standard 3.0 Technical Report 15, Annex 7:

That is, the first character of an identifier can be an uppercase
letter, lowercase letter, titlecase letter, modifier letter, other
letter, or letter number. The subsequent characters of an identifier
can be any of those, plus non-spacing marks, spacing combining marks,
decimal numbers, connector punctuations, and formatting codes (such
as right-left-mark). Normally the formatting codes should be filtered
out before storing or comparing identifiers.

My problem reading the doc was trying to figure out what all those terms for
letters, marks, and codes actually meant. Some of them are obvious while
others require much understanding. I was lazy in trying to understand some
of the terminology, as it does seem to be unnecessarily abstruse or perhaps
poorly explained, so I asked here.
From my reading of the above quotes, no.

I agree unless one of those 'letter' categories include an underscore, which
is doubtful.
Let me dig into the ecma spec to see if anything exists, I can post
back about that later.

If you find it, that would be great. You have answered an important question
in my mind since someone had posted a .NET component on one of the .NET
websites which had a protected identifier starting with an underscore, and
this turned out to be not CLS compliant. I wasn't sure that was the reason,
but suspected it, and now I can answer that thread and explain why.
Appreciated !
 
Edward Diener said:
That's the doc which I refer to above as obscure and difficult to digest.
Making my way through it and trying to understand its terminology, was a
real PITA for me.


I had known this from MSDN, thanks !


My problem reading the doc was trying to figure out what all those terms for
letters, marks, and codes actually meant. Some of them are obvious while
others require much understanding. I was lazy in trying to understand some
of the terminology, as it does seem to be unnecessarily abstruse or perhaps
poorly explained, so I asked here.

I suppose an underscore COULD be a modifer letter, but I doubt it and
wouldn't use it anyway.
There is also a rule in FxCop that mentinos not having members with
underscores.
 
Back
Top