Skip to content

Use proper naming for position/location #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wooorm opened this issue Aug 23, 2017 · 3 comments
Closed

Use proper naming for position/location #13

wooorm opened this issue Aug 23, 2017 · 3 comments
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🧑 semver/major This is a change 🐛 type/bug This is a problem

Comments

@wooorm
Copy link
Member

wooorm commented Aug 23, 2017

Currently, location and position is used interchangeably, while they differ.
This confusion derives from node.position, which holds a location, and a location has start and end set to a position.

I propose:

  • position for node.position (aka “location”, “positional info”)
  • point for node.position.start, node.position.end (as it refers to a point in a file)
@wooorm wooorm added 🧑 semver/major This is a change 🦋 type/enhancement This is great to have labels Aug 23, 2017
@anko
Copy link

anko commented Aug 24, 2017

To clarify: you propose changes only to terminology, not to the functional spec?

@wooorm
Copy link
Member Author

wooorm commented Aug 24, 2017

Yes, only terms! Something like this:

 ### `Node`
 
 ...

 ```idl
 interface Node {
   type: string;
   data: Data?;
-  position: Location?;
+  position: Position?;
 }
 ```
 
 ...
 
-#### `Location`
+#### `Position`
 
-**Location** references a range consisting of two points in a [Unist
+**Position** references a range consisting of two points in a [Unist
-file][file].  **Location** consists of a `start` and `end` position.
+file][file].  **Position** consists of a `start` and `end` point.
 And, if relevant, an `indent` property.
 
 ...
 
 ```idl
-interface Location {
+interface Position {
-  start: Position;
+  start: Point;
-  end: Position;
+  end: Point;
   indent: [uint32 >= 1]?;
 }
 ```
 
-#### `Position`
+#### `Point`
 
-**Position** references a point consisting of two indices in a
+**Point** references a point consisting of two indices in a
 [Unist file][file]: `line` and `column`, set to 1-based integers.  An
 `offset` (0-based) may be used.
 
 ```idl
-interface Position {
+interface Point {
   line: uint32 >= 1;
   column: uint32 >= 1;
   offset: uint32 >= 0?;
 }
 ```

What do you think?

@anko
Copy link

anko commented Aug 24, 2017

I like it. 👍 The naming confused me when I first read the readme, and this would help.

@wooorm wooorm closed this as completed in f2b8587 Aug 24, 2017
@wooorm wooorm added ⛵️ status/released 🐛 type/bug This is a problem 🗄 area/interface This affects the public interface and removed 🦋 type/enhancement This is great to have labels Aug 12, 2019
@wooorm wooorm added the 💪 phase/solved Post is done label Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🧑 semver/major This is a change 🐛 type/bug This is a problem
Development

No branches or pull requests

2 participants