caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain.frisch@lexifi.com>
To: Maxence Guesdon <Maxence.Guesdon@inria.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] Changing precedence and placement of attributes
Date: Mon, 09 Mar 2015 14:37:17 +0100	[thread overview]
Message-ID: <54FDA20D.1000503@lexifi.com> (raw)
In-Reply-To: <20150309141625.0da29f2b@alcazar2>

On 03/09/2015 02:16 PM, Maxence Guesdon wrote:
> I'm quite "shocked" as it becomes inconsistent with other precedences
> in type definitions. By now
>    int * int list
> is parsed as
>    int * (int list)
> and not as
>    (int * int) list
>
> I would expect attributes to be associated the same way.

Attributes really don't behave as type constructors; for instance,

    (int, int) [@foo]

is not allowed in type expressions.


I'd be more concerned about how attributes behave across various 
syntactic categories for similarly looking fragments.  For instance, in 
expressions

   x * y [@foo]

is already currently parsed as

   (x * y) [@foo]


But
  - "x, y [@foo]" is parsed as "x, (y [@foo])"
  - "x * y [@foo] * z" is accepted as an expression, and parsed as "(x * 
y)[@foo] * z".

> How would be parsed the following:
>    int * int [@foo] * int
> ?

This would be rejected.  Doing the same as for expression would be 
weird, since * is a n-ary construction in types, not a binary operator.

(Note: Jérémie prepared a nice table in his pull request 152 on Github; 
it shows how various forms are interpreted currently and after the change.)


Alain

  reply	other threads:[~2015-03-09 13:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-09 11:27 Alain Frisch
2015-03-09 13:16 ` Maxence Guesdon
2015-03-09 13:37   ` Alain Frisch [this message]
2015-03-09 13:57     ` Maxence Guesdon
2015-03-09 14:27       ` Leo White
2015-03-09 16:22         ` Ben Millwood

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=54FDA20D.1000503@lexifi.com \
    --to=alain.frisch@lexifi.com \
    --cc=Maxence.Guesdon@inria.fr \
    --cc=caml-list@inria.fr \
    /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 NNTP newsgroup(s).