compiler-constructionprogramming-languagesspecificationsname-length

Maximum Method Name Length


Does anyone happen to know what the maximum length of a method name is in your programming language of choice? I was going to make this a C# specific question, but I think it would be nice to know across the spectrum.

What are the factors involved as well:


Solution

  • For C# I don't believe there's a specified hard limit. (Section 2.4.2 of the C# 5 spec doesn't give a limit, for example.) Roslyn v2.2.0.61624 seems to have a limit of 1024 characters; this is way beyond the bounds of readability and even a sensible machine-generated name.

    For Java, section 3.8 of the spec states:

    An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.