This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Add inclusive range support for Rust
- From: Tom Tromey <tom at tromey dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Thu, 26 Apr 2018 13:51:23 -0600
- Subject: Re: [RFA] Add inclusive range support for Rust
- References: <20180329201609.13699-1-tom@tromey.com> <20180425162741.pniyyy23uowaxcix@adacore.com>
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
>> BOTH_BOUND_DEFAULT, /* "(:)" */
>> LOW_BOUND_DEFAULT, /* "(:high)" */
>> HIGH_BOUND_DEFAULT, /* "(low:)" */
>> - NONE_BOUND_DEFAULT /* "(low:high)" */
>> + NONE_BOUND_DEFAULT, /* "(low:high)" */
>> + NONE_BOUND_DEFAULT_INCLUSIVE, /* Rust "low..=high" */
>> + LOW_BOUND_DEFAULT_INCLUSIVE, /* Rust "..=high" */
>> };
Joel> Where the bounds exclusive before? The comments and the samples
Joel> of code I have been finding seem to indicate that the bounds
Joel> were already considered inclusive. But I can see how this is
Joel> not all that clear.
Yes, I think you are right -- they were inclusive for Fortran.
>From value_f90_subarray:
return value_slice (array, low_bound, high_bound - low_bound + 1);
What was weird then was that Rust treated them as exclusive, because at
the time Rust only had exclusive ranges.
I can change this and rename the new constants *_EXCLUSIVE.
Joel> Perhaps one way to clarify that is to use language-agnostic mathematical
Joel> notations for the ranges? Eg, using square brackets such as "[1:3[" or
Joel> perhaps "[1:3)" as I have sometimes seen?
I think it's simple to just write out some text explaining the meanings.
Then we won't need to worry whether someone knows the notation.
Tom