Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
Subject: Re: [RFA] Add inclusive range support for Rust
Date: Thu, 26 Apr 2018 19:51:00 -0000	[thread overview]
Message-ID: <87h8nx7nlw.fsf@tromey.com> (raw)
In-Reply-To: <20180425162741.pniyyy23uowaxcix@adacore.com> (Joel Brobecker's	message of "Wed, 25 Apr 2018 09:27:41 -0700")

>>>>> "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


  reply	other threads:[~2018-04-26 19:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29 20:16 Tom Tromey
2018-04-17 19:48 ` Tom Tromey
2018-04-25 15:33   ` Tom Tromey
2018-04-25 16:04     ` Joel Brobecker
2018-04-25 16:27 ` Joel Brobecker
2018-04-26 19:51   ` Tom Tromey [this message]
2018-04-25 16:52 ` Joel Brobecker
2018-04-26 20:16   ` Tom Tromey
2018-04-27 19:13     ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h8nx7nlw.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox