dotnet / vblang

The home for design of the Visual Basic .NET programming language and runtime library.
290 stars 66 forks source link

Proposal: VB remove limitations for using using keywords as names #432

Open vbcodec opened 8 years ago

vbcodec commented 8 years ago
Public Class C1
    Public Property select As Integer
End Class

Compiler show error because name of property is keyword. This is very stretched limitation, without any good reasons. These limitations should be removed.

HaloFour commented 8 years ago

You can wrap keywords in square brackets to use them as identifiers:

Public Class [Class]
    Public Property [Property] As [Class]
End Class
vbcodec commented 8 years ago

@HaloFour I know I can wrap, but for many cases these limitations are unjustified.

DualBrain commented 7 years ago

The existing, tried and true, BASIC way of dealing with this is something I believe isn't deserving of change. Although there are certain keywords that could potentially be relaxed; there are many others that definitely could not.

If if Then do Else else End If

It just doesn't fit with the design of the overall language. Keywords are keywords and the safest approach is to respect that those keywords are supposed to be keywords and... if you really want to use something like a keyword, [] is available.

To turn this completely around... one could argue that all variables should require "names" the developer creates should require [ ] around them. More typing, sure. More clear that those are "user-defined"; absolutely. A good idea... not sure anyone would agree... including me. ;-)

Voting no.

jnm2 commented 7 years ago

Unambiguous readability is better than convenience in my opinion. Code is read much more than written.

Padanian commented 5 years ago

Why don't you just rename the variable.Are you trolling, by any chance?

----- Messaggio Originale ----- Da: "dotnet/vblang" A:"dotnet/vblang" Cc:"Subscribed" Inviato:Mon, 06 May 2019 22:53:22 +0000 (UTC) Oggetto:[dotnet/vblang] Proposal: VB remove limitations for using using keywords as names (#432)

Public Class C1 Public Property select As Integer End Class

Compiler show error because name of property is keyword. This is very

stretched limitation, without any good reasons. These limitations should be removed.

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or mute the thread [2]. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/dotnet/vblang/issues/432", "url": "https://github.com/dotnet/vblang/issues/432", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/dotnet/vblang/issues/432 [2] https://github.com/notifications/unsubscribe-auth/AB3I2BEJHMH6STZ2A2YFAV3PUCZFVANCNFSM4HLD72RQ