Open Whismeril opened 3 years ago
@Whismeril Multiline conversions from single line is complex for translator especially if it is in a loop. In SDK style VB projects System is always included. I could use Math.Min(i, Interlocked.Increment(i)), and I might do some testing with it but I also do decrements. It you want to look at the code and do a PR I will review.
@Whismeril think about DoSomethingWithI(i++, i--,..); There are way too many places with multiple statements don't work and may not even be possible.
I understand the difficulty to translate one line into two, especially for a loop. And (i++, i--,..); is an unstoppable argument, I didn't thought about it.
I only code in VB.Net in order to try helping beginners in forums. I used to says them to search in C# too and convert code. So when I’ve found you project, couple of days ago, I wanted the test it. It’s very good, and your reactivity with my issues is to your credit.
But when compiling Visual Studio returns « import missing import » to the line DoSomethingWithI(Math.Min(Interlocked.Increment(i), i - 1)) my first reaction wasn’t looking for the messing assembly, but wondering was is this strange way of coding. So I suppose beginner could be lost by compiling error in this strange line. If converter could add Import System.Threading or at least convert like this DoSomethingWithI(Math.Min(System.Threading.Interlocked.Increment(i), i - 1)) no error occurs and beginner could have reflexion on a working line, if he see it.
I tested this case in few online converters, they do the same conversion
This code
is converted like this
Interlocked.Increment(i) should work if System.Threading is imported, conversion doesn't notify that.
In
why first increment and then calcul i - 1 ?
this
does the same with one subtraction less
3.
could be obscure for beginner, convert in 2 lines mays be easier for them
goes
and
goes