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

button.namespace.onTap ... #9

Open
toshi0383 opened this issue Feb 14, 2018 · 3 comments
Open

button.namespace.onTap ... #9

toshi0383 opened this issue Feb 14, 2018 · 3 comments

Comments

@toshi0383
Copy link

onTap should live on separated namespace to avoid potential conflict with other library.

e.g. button.rx.event

@takasek
Copy link
Owner

takasek commented Feb 14, 2018

Nice advice!
I'll separate namespace on next major version in a few days.

@takasek takasek self-assigned this Feb 14, 2018
@takasek takasek removed their assignment Aug 13, 2019
@takasek
Copy link
Owner

takasek commented Aug 13, 2019

@Pircate had gave us the detailed implementation at #13 .

But lately I'd changed my mind of the comment above.
I want to discuss about the motivation for introducing namespace.

In short, the namespace style is cool, but seems to resolve no problem.
I don't hit upon any problem if ActionClosurable interfaces are even flat.

May Some beginners think that the extensions created by ActionClosurable are official interface?
But it's very popular to extend interface as you like.
ActionClosurable has simple interface and they strongly combines to the objects' responsibility.
button.onTap... seems natural for me.

In addition, extending init should be separated from the namespace.
For example,
UIBarButtonItem.init(title: "title", style: .plain, closure: ...)
cannot be
UIBarButtonItem.namespace.init(title: "title", style: .plain, closure: ...) .

I'm afraid that introducing a namespace might cause to more complex interface.

@toshi0383
Copy link
Author

You can still create factory method like UIBarButtonItem.namespace.make(title: ...) though?

But it's very popular to extend interface as you like.

Library users can do that, but IMO library authors should avoid the namespace pollution as much as they could.

In addition ...

In short, the namespace style is cool, but seems to resolve no problem.

Just wanted to make it clear that my point was not about "cool or not" or "natural or not".
I even prefer syntax to be as short as possible. (I'm also a golang fun.😎)
But if I try to resolve problems in right way, then I would choose to separate namespace from UIKit or whatever frameworks Apple provides.

Of course this library is not 1000 or 10000 star library, I understand if you can keep it as is.👌
But if I have 1000+ star famous library, I would choose modularity than simplicity.

Thoughts? 🤔

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

No branches or pull requests

2 participants