@Wither Is Fanastic

676 views
Skip to first unread message

Michael Hradek

unread,
May 9, 2017, 8:14:26 AM5/9/17
to Project Lombok
I'm a huge fan of the @Wither annotation.  As such, I will answer these questions in hopes that it will make it into the core:
  • Still not sure that @Wither is an appropriate name for this feature. How about we call it @ChainSetter
  • Should we replace @Wither entirely with a builder class?  No, these have two different uses.  I'd prefer to use @Builder separately.  The @Wither chain setters do not require some sort of execution or building once assembled unlike @Builder. While this isn't necessarily the case that built objects will need execution, the purpose and usage in the builder pattern is clear as is chain setting.
Thanks for this awesome plugin!

Reinier Zwitserloot

unread,
May 9, 2017, 9:05:25 AM5/9/17
to Project Lombok
ChainSetter is not appropriate because 'setter' implies that you mutate the existing object.

In fact, @ChainSetter sounds more like a setter that returns 'this' instead of 'void', so that I can do: someMutableThingie.setName("a").setAge(10). Which isn't what @Wither does, so that's no good.

Marco Servetto

unread,
May 9, 2017, 7:30:34 PM5/9/17
to project...@googlegroups.com
I have published an article using the term wither for that concept and
no one complained about the name.
> --
> You received this message because you are subscribed to the Google Groups
> "Project Lombok" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to project-lombo...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Martin Grajcar

unread,
May 9, 2017, 8:36:16 PM5/9/17
to project...@googlegroups.com
I'm afraid there's no better name, at least there was nothing usable in the length discussion in 2010 (all better sounding names clash with something). It may be me who made the authors accept the name.

For me the clear winner is still @Wither. It's an English word with a negative connotation. And Setter is a dog type and Getter is a manga super robot. So what?

There were much worse names proposed, e.g., PDSFunnily enough, the intended meaning (Persistent Data Structure) is missing from the Wikipedia (though it offers things like Partially Deceased Syndrome, Paroxysmal depolarizing shift and Particularly Dangerous Situation).

On Tuesday, May 9, 2017 at 2:14:26 PM UTC+2, Michael Hradek wrote:
Should we replace @Wither entirely with a builder class?  No, these have two different uses.  I'd prefer to use @Builder separately.  The @Wither chain setters do not require some sort of execution or building once assembled unlike @Builder. While this isn't necessarily the case that built objects will need execution, the purpose and usage in the builder pattern is clear as is chain setting.

The introduction of @Builder(toBuilder=true) has made @Wither easily replaceable as you can write x.toBuilder().a(1).build() instead of x.withA(1). However, the latter is twice as fast, much more readable, and avoids garbage. The former is better when many properties get changed at once.


> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.

Mark

unread,
Aug 21, 2019, 7:46:47 PM8/21/19
to Project Lombok
Where I work we use with... methods and make all properties public final as an alternative to setters and getters. The Wither annotation would definitely make me more productive. The only problem for me is that it is still in experimental. I've been burned before (not with Lombok) when using code that was 'experimental' so I won't use it until it moves to stable. I don't care about the name or any of the extra options. Would it be possible to accelerate the move to stable by creating a simplified version that did not have any of the controversial options?


On Tuesday, May 9, 2017 at 9:36:16 PM UTC-3, Maaartin G wrote:
I'm afraid there's no better name, at least there was nothing usable in the length discussion in 2010 (all better sounding names clash with something). It may be me who made the authors accept the name.

For me the clear winner is still @Wither. It's an English word with a negative connotation. And Setter is a dog type and Getter is a manga super robot. So what?

There were much worse names proposed, e.g., PDSFunnily enough, the intended meaning (Persistent Data Structure) is missing from the Wikipedia (though it offers things like Partially Deceased Syndrome, Paroxysmal depolarizing shift and Particularly Dangerous Situation).

On Tuesday, May 9, 2017 at 2:14:26 PM UTC+2, Michael Hradek wrote:
Should we replace @Wither entirely with a builder class?  No, these have two different uses.  I'd prefer to use @Builder separately.  The @Wither chain setters do not require some sort of execution or building once assembled unlike @Builder. While this isn't necessarily the case that built objects will need execution, the purpose and usage in the builder pattern is clear as is chain setting.

The introduction of @Builder(toBuilder=true) has made @Wither easily replaceable as you can write x.toBuilder().a(1).build() instead of x.withA(1). However, the latter is twice as fast, much more readable, and avoids garbage. The former is better when many properties get changed at once.


> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project...@googlegroups.com.

Marco Servetto

unread,
Aug 21, 2019, 8:03:27 PM8/21/19
to project...@googlegroups.com
I love Wither too, and I think it is about time it goes out of
experimental, as it is, without any change.
Would any Lombok user on this mailing list have any complaint if
wither becomes stable 'as is'?
> To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/project-lombok/60464964-684a-4b92-abce-c955e691698e%40googlegroups.com.

Victor Williams Stafusa da Silva

unread,
Aug 21, 2019, 11:15:52 PM8/21/19
to project...@googlegroups.com
I don't care about it being experimental and use it anyway. It is a great feature.

The only problem is having ".experimental" as part of the package name, implying some possible future compatibility problem of having to change my imports in the future or getting a bunch of deprecated warnings (or even compilation errors) for not doing so, when it is considered stable.

Michael Berry

unread,
Aug 22, 2019, 3:22:46 AM8/22/19
to project...@googlegroups.com
I use it and see no problem with it going stable as is, personally.

Reinier Zwitserloot

unread,
Aug 22, 2019, 9:30:54 AM8/22/19
to Project Lombok
Roel actually was planning to mess with wither in the next release. Specifically, add lambda variants, along this line (where 'foo' is an int property):

public Self withFoo(ToIntFunction<Self> func) { int newValueForFoo = func.apply(this); return new Self(allFieldsTheSameExceptFoo); }

Perhaps naming comes up for that again, as overloading means that passing 'null' is a problem (ambiguous invocation).

The name (@Wither) remains the biggest blocker to making it stable.
> To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.

> To view this discussion on the web visit https://groups.google.com/d/msgid/project-lombok/60464964-684a-4b92-abce-c955e691698e%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.

Victor Williams Stafusa da Silva

unread,
Aug 22, 2019, 12:51:35 PM8/22/19
to project...@googlegroups.com
If the name is the biggest blocker, then I think that you have no blocker at all. It is perhaps a bit ugly, but it is very clear, concise and consistent.

> To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.

> To view this discussion on the web visit https://groups.google.com/d/msgid/project-lombok/60464964-684a-4b92-abce-c955e691698e%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/project-lombok/0580d5c6-ab03-4abd-ba8e-77089fba0814%40googlegroups.com.

Michael Berry

unread,
Aug 22, 2019, 12:53:55 PM8/22/19
to project...@googlegroups.com
Sorry to ask a potentially stupid question - but why is the current name an issue? 

Mark

unread,
Aug 23, 2019, 9:30:05 AM8/23/19
to Project Lombok
I'm not part of the project but I'll express my opinion anyways. This is an eminently useful feature but its use is being inhibited because of some future plans that may or may not come to fruition. The documentation and changelog says that Wither first came out in version 0.11.4 on August 13, 2012. If a better name has not popped up in that interval, I don't think anyone will ever think of a better one.


On Thursday, August 22, 2019 at 10:30:54 AM UTC-3, Reinier Zwitserloot wrote:
Roel actually was planning to mess with wither in the next release. Specifically, add lambda variants, along this line (where 'foo' is an int property):

public Self withFoo(ToIntFunction<Self> func) { int newValueForFoo = func.apply(this); return new Self(allFieldsTheSameExceptFoo); }

Perhaps naming comes up for that again, as overloading means that passing 'null' is a problem (ambiguous invocation).

The name (@Wither) remains the biggest blocker to making it stable.

On Thursday, August 22, 2019 at 9:22:46 AM UTC+2, Michael Berry wrote:
I use it and see no problem with it going stable as is, personally.

On Thu, 22 Aug 2019, 04:15 Victor Williams Stafusa da Silva, <victor...@gmail.com> wrote:
I don't care about it being experimental and use it anyway. It is a great feature.

The only problem is having ".experimental" as part of the package name, implying some possible future compatibility problem of having to change my imports in the future or getting a bunch of deprecated warnings (or even compilation errors) for not doing so, when it is considered stable.

> To unsubscribe from this group and stop receiving emails from it, send an email to project...@googlegroups.com.

> To view this discussion on the web visit https://groups.google.com/d/msgid/project-lombok/60464964-684a-4b92-abce-c955e691698e%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project...@googlegroups.com.

Reinier Zwitserloot

unread,
Aug 24, 2019, 5:55:41 PM8/24/19
to Project Lombok
Fair enough, I guess the name will stick.

However, Roel has plans to add some features this week (primarily, to add a lambda based variant which is much nicer when changing nested immutable structures). After that we'll take it out of experimental and into main.
Reply all
Reply to author
Forward
0 new messages