Re: Bracketed types

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



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:
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
use the type without qualifying it by its namespace:

\\\
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.

--





.



Relevant Pages

  • Re: Using XSLT for sending emails
    ... And where is your "ext" namespace declaration? ... N> BusinessLogic.EmailTemplate.SendEmailMessage(String emailTo, String ... N> Public Sub New ... N> Dim pr As DataAccess.DataAccessBase.ProcedureResults ...
    (microsoft.public.dotnet.general)
  • Re: Shared functions not accessible
    ... Import the Namespace. ... Public Shared MySQL as String ... Dim Cmd as New SQLCommand ... The namespace is MyFunctions and the Class is CryptoUtil. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Can I enter multiple zip codes in a parameter query?
    ... WHERE string from the results. ... This example applies to muliple keywords entered into ... Dim strWhere As String ... Dim strWord As String ...
    (microsoft.public.access.forms)
  • Re: .NET Framework 2.0 features on VS 2005.
    ... You code will not compile, since you also used "System.IO" name space, which ... distinguish which namespace it belongs to: ... Dim crlfs() as String = ...
    (microsoft.public.dotnet.general)
  • Re: Parsing
    ... Dim strWhere As String ... Dim varKeywords As Variant 'Array of keywords. ... >> Could someone please point me to a function/module for Access 2000 that ...
    (comp.databases.ms-access)