Skip to content
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

优化:require写法规范化 #332

Closed
Miss-you opened this issue Mar 15, 2021 · 3 comments
Closed

优化:require写法规范化 #332

Miss-you opened this issue Mar 15, 2021 · 3 comments

Comments

@Miss-you
Copy link
Contributor

Miss-you commented Mar 15, 2021

不建议的写法:

local redis = require "resty.redis"

建议写法

local redis = require("resty.redis")
@membphis
Copy link
Collaborator

这里没有正确和错误的说法,是个风格喜好问题。

有些人喜欢极简,能少写一行,就不多写。
我则更喜欢不用猜,代码易读。所以我更希望 lua 里使用下面的写法

@Miss-you
Copy link
Contributor Author

这里没有正确和错误的说法,是个风格喜好问题。

有些人喜欢极简,能少写一行,就不多写。
我则更喜欢不用猜,代码易读。所以我更希望 lua 里使用下面的写法

我觉得应该统一,而不是两种都有。最佳实践是咱们的经验,那么风格上也应该遵循我们自己的喜好

@Miss-you
Copy link
Contributor Author

这里没有正确和错误的说法,是个风格喜好问题。

有些人喜欢极简,能少写一行,就不多写。
我则更喜欢不用猜,代码易读。所以我更希望 lua 里使用下面的写法

将正确和错误改为建议和不建议

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants