dotnet / dotnet/vblang

[Proposal] Syntax Expressions Aliases.

Open
#528 23 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

[Proposal] Syntax Expressions
I want to shorten long expressions. Sometimes using with or assigning the expression to a variable is not a solution. For example:
```
If type1.Assembly.Location.Length = type2.Assembly.Location.Length Then

End If
```

I suggest to rewrite it as:
```VB.NET
using Len = of(Type).Assembly.Location.Length

If type1.Len = type2.Len Then

End If
```

1. I am suggesting Using so we can use it locally. Another version can use Imports at the file level.
2. No need for end using. The scope is to the end of the block.
3. The `(Of T)` defines the type the expression belongs to, so we can have Intellinsense and Vb can check the syntax of the expression.
4. The original expression should be shown in a tool tip when hovering over `Len` word.

This is useful if the expression `Len` appears many times in the scope, and also it can shorten LinQ and lambdas so they become more readable.

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.