Giter Club home page Giter Club logo

Comments (3)

jberdine avatar jberdine commented on July 24, 2024

My impression from very little experience with OCaml attributes is that
the preceding versus following choice was made in the right way for the
OCaml uses. For polytypic things like defining pretty printers and
comparison functions, it seems that the type definition preceding
attributes makes much more sense. Most of the uses of attributes I have
seen in C# were essentially lint suppression, and so short compared to
C#'s verbose type definitions.

On 26 Dec 2015, at 12:00, Jordan W wrote:

Rust chose to make their "attributes" syntax follow that of C#.

It turns out that OCaml has recently added attributes (they're really
good - they are intended to be used for more powerful features than
Rust's attributes (full on macro/AST rewriting)), and they have their
own syntax. It would be trivial to change the syntax of Reason's
attributes to match that of C# and (now) Rust:

In OCaml

  • [@attribute] applies to an inline syntactic construct
    (typically).
  • [@@attribute] applies to the preceding syntactic construct such
    as module item, class item.
  • [@@@attribute] applies to the containing syntactic construct.

In Rust,

  • #[attribute] applies to the following syntactic construct.
  • #![attribute] applies to the containing syntactic construct.

https://doc.rust-lang.org/reference.html#attributes

This is another one of those things that really doesn't matter to most
of us, but why not change it since it's trivial? (I don't have any
code that uses attributes, and I believe none of us do either, so this
is lower pri).


Reply to this email directly or view it on GitHub:
#27

from reason.

jordwalke avatar jordwalke commented on July 24, 2024

I agree.

from reason.

jordwalke avatar jordwalke commented on July 24, 2024

I'll close this particular suggestion.

from reason.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.