dotnet / dotnet/vblang

Proposal: Use $ as .ToString( )

Open
#444 9 comments 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

The discussion about using $ as an anonymous ref in with blocks (#437) made me recall that $ in VB was always a symbol for string type, and recently for literal string interpolation. So, it doesn't feel right to use $ for any thing other string operations.
This made me think of this possible usage:
```vb.net
Dim n As Integer
Dim s = n$ + 3 ' currently this gives error
```

The $ here stands for `.ToString( )`, So, `s` should be inferred as a string.
```vb.net
Dim n As Integer
Dim s = n.ToString() + 3
```

So, My suggestion is to append $ at the end of any data type. as a shortcut for `.ToString( )`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the related discussion in #437 and the current Visual Basic rules for string conversions and interpolation. Compare the proposed n$ expression with n.ToString() and record a language-design decision covering syntax, typing, and compatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
visualbasic
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.