arnetheduck / nph

An opinionated code formatter for Nim
Other
77 stars 12 forks source link

Spacing is removed on anonymous procs #22

Closed ire4ever1190 closed 5 months ago

ire4ever1190 commented 6 months ago

The spacing before the parenthesis in an anonymous proc is removed

type EventCallback = proc (timeReceived: Time)
# Becomes
type EventCallback = proc(timeReceived: Time)

app.handleRoute("/test") do ():
  discard
# Becomes
app.handleRoute("/test") do():
  discard
ire4ever1190 commented 6 months ago

Seems to be due to the removal of the putWithSpace. Is this intended style?

arnetheduck commented 6 months ago

Indeed - the space there doesn't seem to serve any purpose - we don't put a space after the function name for example.

ire4ever1190 commented 6 months ago

While not explicitly said, NEP1 does have a space in the one of the examples (Although the status guide does have a counterexample.

IMO having the space makes sense since you'd have a space before the name so when it is empty it'd be "proc " + "" + "(params)"

arnetheduck commented 5 months ago

oof. https://github.com/nim-lang/Nim/pull/23105 removed the space from nep1 (it wasn't a "feature" of the PR, just collateral damage/benefit) so now all the guides are space-free.. tbh I don't have that much of a strong opinion either way, ie both styles can be rationalized which is the worst kind ;) is this a hill to die on?

ire4ever1190 commented 5 months ago

haha, not big enough a hill for me to die on. I should be able to live with it