dotnet / dotnet/vblang

``?`` as Boolean type char

Open
#148 6 comments 0 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 ``?`` character was chosen using for the ``Nullable`` structure type currently. And all of the stand along ``?`` type char currently was defined as nullable ``Object`` type, but the ``Object`` is already can be ``Nothing``.

```vbnet
' local flag As Object
Dim flag?

' param flag As Object = True
Sub Test(Optional flag? = True)
End Sub
```

In my opinion, the ``?`` character have some literal meaning like:

+ yes or no?
+ true or false?
+ success or failure?
+ right or wrong?
+ exists or not?

So proposal, when user define a variable with a stand along ``?`` character, then it should be defined as a ``Boolean`` variable:

```vbnet
' boolean, exists or not?
Dim exists? = list.IndexOf("123") > -1
' nullable integer
Dim n As Integer?

Sub Test(path$, Optional ByRef skip? = False, Optional count As Integer? = 0)
End Sub
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.