From 9c2b61b346ca55b4d70f010aaec78b8ff44d6a4a Mon Sep 17 00:00:00 2001 From: Alessandro Coglio Date: Tue, 20 Jul 2021 23:22:12 -0700 Subject: [PATCH] [RFC] Move a discussion under 'Alternatives'. --- docs/rfc/005-countdown-loops.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/rfc/005-countdown-loops.md b/docs/rfc/005-countdown-loops.md index 66b7a40e91..0208f4ab8b 100644 --- a/docs/rfc/005-countdown-loops.md +++ b/docs/rfc/005-countdown-loops.md @@ -142,7 +142,21 @@ function shaker_sort(a: [u32; 10], const rounds: u32) -> [u32; 10] { } ``` -## Possible Future Extension +# Drawbacks + +No obvious drawback. + +# Effect on Ecosystem + +Suggested change should have no effect on ecosystem because of its backward compatibility. + +# Alternatives + +## Mocking + +Coundown loops can be mocked manually. + +## Exclusive Starting Bounds While the ability to designate the ending bound of a loop as either exclusive or inclusive is critical as discussed below, we could also consider adding the ability to designate the starting bound of a loop as either exclusive or inclusive. @@ -158,7 +172,7 @@ The most symmetric but verbose approach is exemplified as follows: * `5>..=0` for `4 3 2 1 0` * `5=..>0` for `5 4 3 2 1` * `5>..>0` for `4 3 2 1` -That is, this approach makes exclusivensss an inclusiveness implicit. +That is, this approach makes exclusivensss and inclusiveness implicit. The use of `<` vs. `>` also indicates a loop direction, which can be inferred anyhow when the `const` bounds are resolved, so that would entail an additional consistency check, namely that the inequality sign/signs is/are consistent with the inferred loop direction. @@ -168,17 +182,3 @@ The most symmetric default would be perhaps `=` for both bounds, but that would be a different behavior from current Leo. We could instead go for different defaults for starting and ending bounds, i.e. `=` for the starting bound and `<` or `>` (depending on direction) for the ending bound. - -# Drawbacks - -No obvious drawback. - -# Effect on Ecosystem - -Suggested change should have no effect on ecosystem because of its backward compatibility. - -# Alternatives - -## Mocking - -Coundown loops can be mocked manually.