fsharp / fsharp/fslang-suggestions
Allow units of measure in sequence ranges
- Dominant language
- No language data
- Stars
- 373
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
I propose we extend sequence expressions to handle ranges involving units of measure. Currently we cannot do the following:
```
let maximumDistance = 3
let minimumDistance = 1
let trials = [ minimumDistance .. maximumDistance ]
```
The existing way of approaching this problem in F# is to generate a range from bare integers and then map a multiplication to add the dimension
## Pros and Cons
The advantages of making this adjustment to F# are
- An improvement to the safety of code by removing error potential in dropping the units and then adding them back
- More concise, readable code
The disadvantages of making this adjustment to F# are
- None that I can think of
## Extra informtion
Estimated cost (XS, S, M, L, XL, XXL):
M? (because of the added complication of ``min .. step .. max``)
Related suggestions: (put links to reated suggestions here)
[Allow units of measure in for loops #534 ](https://github.com/fsharp/fslang-suggestions/issues/534)
## Affadavit (must be submitted)
Please tick this by placing a cross in the box:
* [x] This is not a question (e.g. like one you might ask on [stackoverflow](http://stackoverflow.com)) and I have searched stackoverflow for discussions of this issue
* [x] I have [searched both open and closed suggestions on this site](http://github.com/fsharp/fslang-suggestions/issues) and believe this is not a duplicate
* [x] This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it.
Please tick all that apply:
* [x] This is not a breaking change to the F# language design
* [x] I would be willing to help test this
* [ ] I or my company would be willing to help crowdfund F# Software Foundation members to work on this
Contributor guide
No contributing guide indexed for this repository
Research direction
No files, tests, or entry points are identified in the proposal. Review the related for-loop suggestion (#534) and evaluate the shown unit-of-measure range examples, including the min..step..max form; done means an agreed language design and a validated implementation plan.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100