resyntax icon indicating copy to clipboard operation
resyntax copied to clipboard

Reorder provided identifiers to match their order of appearance

Open jessealama opened this issue 4 years ago • 3 comments

(Not sure if this is what resyntax should be doing, but it feels in scope to me; feel free to decline this if it's not what you have in mind.)

For the sake of code aesthetics, I find it nice when the order of identifiers provided by a module matches the order in which they are defined. When things get out-of-order, the code starts to feel haphazard.

Rewrite, for example, a module like this

#lang racket
(provide g f)
(define (f x) (+ x x))
(define g 3)

to this:

#lang racket
(provide f g)
(define (f x) (+ x x))
(define g 3)

jessealama avatar Jan 15 '21 05:01 jessealama

This feels a little too heavy handed to me. Sometimes definitions have ordering dependencies that there isn't much reason to expose in the module API, which is what I generally think of the provide form as describing. Imagining a future where resyntax is shipped with the main distribution and on by default, showing suggestions and warnings in DrRacket, this seems like something that would get a lot of "why is this being suggested?" feedback.

jackfirth avatar Jan 15 '21 11:01 jackfirth

Just a suggestion: Instead of closing the proposal, maybe you could tag it as controversial or matter-of-taste or something, which enables others to refine the idea, and also this rule could still be useful if this rule can be applied manually (say like a menu item in DrRacket, possibly via a quickscript if it's not there by default). (I don't mean to force this onto you—if you prefer this kind of issues to be closed, no worries.)

Metaxal avatar Jan 15 '21 11:01 Metaxal

Sounds like a good idea to me. I've created a project for opt-in rules and added this issue to it.

jackfirth avatar Jan 15 '21 11:01 jackfirth