public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Add inclusive range support for Rust
Date: Wed, 25 Apr 2018 16:27:00 -0000	[thread overview]
Message-ID: <20180425162741.pniyyy23uowaxcix@adacore.com> (raw)
In-Reply-To: <20180329201609.13699-1-tom@tromey.com>

Hi Tom,

>  /* In an OP_RANGE expression, either bound could be empty, indicating
>     that its value is by default that of the corresponding bound of the
> -   array or string.  So we have four sorts of subrange.  This
> -   enumeration type is to identify this.  */
> -   
> +   array or string.  Also, the upper end of the range can be exclusive
> +   or inclusive.  So we have six sorts of subrange.  This enumeration
> +   type is to identify this.  */
> +
>  enum range_type
>    {
>      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"  */
>    };

Where the bounds exclusive before? The comments and the samples
of code I have been finding seem to indicate that the bounds
were already considered inclusive. But I can see how this is
not all that clear.

Perhaps one way to clarify that is to use language-agnostic mathematical
notations for the ranges? Eg, using square brackets such as "[1:3[" or
perhaps "[1:3)" as I have sometimes seen?

I'll continue with the rest of the patch in the meantime...

-- 
Joel

  parent reply	other threads:[~2018-04-25 16:27 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 [this message]
2018-04-26 19:51   ` Tom Tromey
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=20180425162741.pniyyy23uowaxcix@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).