-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Range 1 To 10 Step 2
expressions
#25
Comments
LOVE IT! |
1 To 10 Step 2
expressions
@AnthonyDGreen I've updated this proposal to include the feature discuss in #180 |
@AnthonyDGreen Then in binding and lowering detect this and convert to use For Loop semantics, rather than Range semantics. This would allow us to reuse the existing parsing code (note changed to return a |
@AnthonyDGreen |
Changing existing nodes is incredibly tricky due to back compat problems. The syntax nodes are a public API and changing/removing nodes can easily break consumers, including analyzers. Plus it's not usually desirable to have a single node in multiple places just because of visual similarity. |
@AdamSpeight2008 Would the iteration variable be |
@zspitz The type used for the iteration variable, will follow the same type rules used by |
For a slightly different scenario. I want to use a standalone range inside an XML literal. e.g. given this today: Dim qx =
<div>
<%= From i In {1, 10} Select <item ref=<%= $"{i}" %> /> %>
</div> I want to replace Dim qx =
<div>
<%= From i In 1 To 10 Select <item ref=<%= $"{i}" %> /> %>
</div>
Dim qxB =
<div>
<%= From i In {1 To 10} Select <item ref=<%= $"{i}" %> /> %>
</div> (I'm not a fan of squiggles in VB, but ranges are sets and {} are set delimiters, and we're already using them like this for arrays, a different flavour of set.) |
If we get the the operations ordering correctly we shouldn't need parenthesis, for example |
(Ported from Roslyn repo)
Range Query Syntax
Updated (04 Dec 2017)
The
range expression
will produce a range object, that has the capability of being enumerated.Compatibility rules of types, will be the same as those used for addition and subtract.
This to allow simple unsigned type to be used with signed types.
We may want a code advisory, that can detect possible failures at compile-time. Eg unsigned beyond the limits of signed.
The range used will be (inclusive, inclusive), so that expressing the full range of values is permitted eg.
Production of the values from the enumerator isnot allowed to overflow / underflow, regardless of any options eg
Option Checked Off
This is to allow an alternative form of For LoopThe text was updated successfully, but these errors were encountered: