-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Yes, I think ranges really are just UDTs with syntactic sugar for constructing them. In old Q#, you could already manually "update" any range field:
function UpdateRangeStart(r : Range, start: Int) : Range {
return start..RangeStep(r)..RangeEnd(r);
}
function UpdateRangeStep(r : Range, step : Int) : Range {
return RangeStart(r)..step..RangeEnd(r);
}
function UpdateRangeEnd(r : Range, end : Int) : Range {
return RangeStart(r)..RangeStep(r)..end;
}
So I don't see any problem with w/
being sugar for those functions. In fact I'd actually recommend we refactor the compiler to literally define Range
in the core library:
newtype Range = (Start : Int, Step : Int, End : Int);
and lower range expressions into constructor calls referencing the core type. That would remove all the special casing for "primitive" fields.
Originally posted by @SamarSha in #308 (comment)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request