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

tg_width以及and() #33

Open
LuckinDog opened this issue May 27, 2019 · 1 comment
Open

tg_width以及and() #33

LuckinDog opened this issue May 27, 2019 · 1 comment

Comments

@LuckinDog
Copy link

正如其他人也提了这个问题, 外层的tg已经提供nameSpace了,后面的为什么不采用left,right,width之类的更为简洁和易于理解了?而且对于函数式编程这个特点来说, and(),还是有明显的smalltalk语法的影子啊,这要是OC版本无可厚非,Swift这样就不友好了。

@youngsoft
Copy link
Owner

老实说,其实我个人是不大喜欢链式语法:一来一行的代码加长了,我更喜欢一行的代码尽量的少;二来不利于调试,当出现问题后不知道是哪个方法处问题了。

其实当时也讨论和比较过是单独开辟出一个namespace来实现这种扩展还是用tg开头的函数来实现,最终的结果还是选择目前的解决方案。

至于为什么又提供and方法其实也是为了照顾那些链式语法控,你可以理解为这是一个语法糖。如果您希望提供一个tg的namespace的话是否可以考虑添加这个语法糖到这个库中呢?一起共建吗。

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