Re: Bracketed types
- From: Mike <unknown@xxxxxxxxxx>
- Date: Mon, 25 May 2009 02:07:46 -0400
Cor Ligthert[MVP] wrote:
Mike,>
No it solves things which you simply cannot do in C# which completely rely on namespaces. However, I recognize it only as sugar.
> It has nothing to do with case sensitivity, by instance a public
> properties which are used in C# and C++ with the same names but
> written with different cases are in those program languages unique
> identifier, but they are not CLI compliant but you cannot solve
> this with these brackets.
>
> However, because it can be used everywhere it can also be used in a
> wrong way, like in the sample you have showed
First, you seem to be a combative person so I hope by me continuing to talk to you doesn't go off the deep end. Please take nothing I say the wrong way and respect there are solid opinions here, you probably won't be able to change. :-) Thanks.
Understood, but you don't need brackets like this in C/C++/C# because it is a long tradition to do thing things like:
TYPE_NAME type_name
which is akin to
dim type_name as TYPE_NAME
which can be confusing, hence a helper syntax is useful:
dim [type_name] as TYPE_NAME
Yes, there are reasons why it helps (i.e. like you must use a keyword, like Next). I don't like it, but I can see the why now and can probably find myself using it.
Whether that is GOOD or BAD, its a matter of debate. For me, its about code readability and that's important.
That said, I'm also learning VB.NET and I recognize it has its own set of semantics. I generally will never use something that common for a language, isn't required and/or that make *things* difficult to understand, not now, not next year, but 3, 5, 10 years down the road. I'm an ex-arrogant APL programmer and there isn't is more cryptic than APL and even in C/C++, one can be very cryptic. But today (at least 10-15 years or so), I prefer code readability utmost over anything else.
Thanks for your input.
--
"Mike" <unknown@xxxxxxxxxx> wrote in message news:OEMpvQP3JHA.1512@xxxxxxxxxxxxxxxxxxxxxxx.Herfried K. Wagner [MVP] wrote:"Armin Zingler" <az.nospam@xxxxxxxxxx> schrieb:use the type without qualifying it by its namespace:The _only_ reason to use them is to use a keyword as an identifier, be it a
class name or a variable name.
One exception to this rule: A type's name is the same as one of the keywords of the intrinsic types of VB, the namespace containing the custom type is imported (explicitly or implicitly), and you want to
\\\
Private Sub Test()
Dim s As [String] ' Binds to the custom 'String' class.
Dim t As String ' Binds to 'System.String'.
End Sub
...
Public Class [String]
Public Value As String
End Class
///
This is my 3rd post, that wasn't posted.. hope it takes now.
I believe I understand the basic reason for it. VB is not case sensitive with identifiers. It is common practice in C/C++ and I guess C# to do things like
TYPE_NAME type_name
with clear type or variable recognition. Using brackets in VB.NET helps with this and also to address conflicts with inherited keywords, i.e. Next.
Anyway, thanks for everyone's input.
--
- Follow-Ups:
- Re: Bracketed types
- From: Cor Ligthert[MVP]
- Re: Bracketed types
- References:
- Bracketed types
- From: Mike
- Re: Bracketed types
- From: Herfried K. Wagner [MVP]
- Re: Bracketed types
- From: Mike
- Re: Bracketed types
- From: Armin Zingler
- Re: Bracketed types
- From: Mike
- Re: Bracketed types
- From: Armin Zingler
- Re: Bracketed types
- From: Herfried K. Wagner [MVP]
- Re: Bracketed types
- From: Mike
- Re: Bracketed types
- From: Cor Ligthert[MVP]
- Bracketed types
- Prev by Date: Generic Function, Interface or Class
- Next by Date: Re: Bitmap from a file
- Previous by thread: Re: Bracketed types
- Next by thread: Re: Bracketed types
- Index(es):
Relevant Pages
|