Skip to content

Add inline increment/decrement functionality. #1

Description

@DualBrain

See dotnet/vblang#231

My thinking is that the following C# code...

int value = 1;
Console.WriteLine($"({value}) value=5 = {value=5} ({value})");
Console.WriteLine($"({value}) value++ = {value++} ({value})");
Console.WriteLine($"({value}) value-- = {value--} ({value})");
Console.WriteLine($"({value}) ++value = {++value} ({value})");
Console.WriteLine($"({value}) --value = {--value} ({value})");

converted to VB as...

Dim value As Integer = 1
Console.WriteLine($"({value}) value=5 = {value.Assign(5)} ({value})")
Console.WriteLine($"({value}) value++ = {value.Incr} ({value})")
Console.WriteLine($"({value}) value-- = {value.Decr} ({value})")
Console.WriteLine($"({value}) ++value = {value.Incr(Apply.Before)} ({value})")
Console.WriteLine($"({value}) --value = {value.Decr(Apply.Before)} ({value})")

This works great for Integer, UInteger, Long and ULong... but the other types can't use the same "trick". More thinking needs to be done to determine if there is method where the same sort of code pattern can work on Byte, SByte, Char, Short, UShort, Single, Double, etc.

Example.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions