Comments (3)
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.
I agree.
from reason.
I'll close this particular suggestion.
from reason.
Related Issues (20)
- refmt removes unremovable parentheses
- let open doesn't support structs
- String literals and String module issues HOT 2
- Fatal error after installing on Windows 10
- Add dark theme for Doc part
- Error recovery for letops HOT 3
- Inlined functions look wrongly formatted
- v4 syntax TODO
- Attributes and other expressions add single space as identation HOT 1
- Format reason codebase with ocamlformat? HOT 1
- Better printing extensions/attributes inside sequences (and other nested expressions)
- some questions "for what?" HOT 2
- local open with a record formats wrongly
- Empty Functor adds unit on declaration and empty module on instantiation
- local open + let bindings HOT 1
- Comments and opens HOT 2
- module types with one line and attribute prints in one line instead of two HOT 1
- Release process HOT 2
- Polyvariants following printing as variants
- Upgrade menhir to recent version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reason.