docs icon indicating copy to clipboard operation
docs copied to clipboard

CType is referred to as a function. Isn't it an operator ?

Open Youssef1313 opened this issue 4 years ago • 5 comments

I think the CType is an operator, not a function.

Same thing applies to these articles:

  • https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/functions/conversion-functions
  • https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/functions/type-conversion-functions

Please, correct me if I'm mistaken. Once this issue is reviewed, I can work on fixing it if I'm correct.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Youssef1313 avatar Dec 28 '19 17:12 Youssef1313

ping @KathleenDollard What do you think should change here?

It looks like CType is classified as an expression in the VB specification.

BillWagner avatar Jan 02 '20 15:01 BillWagner

ping @KathleenDollard

Youssef1313 avatar May 26 '20 17:05 Youssef1313

This issue has been closed as part of the issue backlog grooming process outlined in #22351.

That automated process may have closed some issues that should be addressed. If you think this is one of them, reopen it with a comment explaining why. Tag the @dotnet/docs team for visibility.

dotnet-bot avatar Jan 25 '21 15:01 dotnet-bot

@BillWagner I think this one still needs to be re-opened. Probably also worth seeking help from the compiler team for the correct term. Tagging @CyrusNajmabadi @AlekseyTs for this.

Youssef1313 avatar Jan 25 '21 15:01 Youssef1313

If we are talking about expressions that convert types, it looks like specification refers to them as Cast Expressions: "A cast expression coerces an expression to a given type. Specific cast keywords coerce expressions into the primitive types. Three general cast keywords, CType, TryCast and DirectCast, coerce an expression into a type."

There is a single reference to "CType operator" in the specification which is used to refer to overloading a conversion operator. I didn't find references to "CType function" in the specification. It is quite possible that this is a term used by VB6.

AlekseyTs avatar Jan 25 '21 16:01 AlekseyTs