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

support optional elements and attributes #48

Merged
merged 1 commit into from
Sep 26, 2017

Conversation

cornerman
Copy link
Member

This is my attempt to fix #22. Does it make sense to you?

@LukaJCB
Copy link
Member

LukaJCB commented Sep 26, 2017

LGTM, thank you very much :)

@LukaJCB LukaJCB merged commit d15a231 into outwatch:master Sep 26, 2017
@PerWiklander
Copy link
Contributor

Nice. Thanks!
Did we really need the new operator :=? though?

@cornerman cornerman deleted the optional-builder branch September 26, 2017 16:02
@cornerman
Copy link
Member Author

In the corresponding issue I have looked at the link from scalajs-react and implemented it with the same operator, which makes the semantics explicit. Overloading the := operator would also be fine with me; but trying it now, I am also not really able to convince the compiler to use the option overload :)

@PerWiklander
Copy link
Contributor

Being explicit might be a good idea actually. But... wouldn't having OptionIsEmptyModifier in scope make it work with := ? So that I could choose to import that if I want to use the normal operator and be implicit?

@cornerman
Copy link
Member Author

cornerman commented Sep 26, 2017

Well, the implicit is already in scope, you can already write it like so (which is the same as :=?):

input(
  Option("bar").map(data.foo := _),
  Option.empty.map(data.bar := _)
)

However, I also tried importing the implicit but did not help. Ideas welcome!

@PerWiklander
Copy link
Contributor

Sorry, I slipped while thinking :-)

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

Successfully merging this pull request may close these issues.

Optional elements and attributes
3 participants