Is setting a buildable property by reference supported?

19 views
Skip to first unread message

o...@fleaflicker.com

unread,
Dec 22, 2017, 10:01:46 AM12/22/17
to FreeBuilder
I may have overlooked it but it there doesn't appear to be a way to set a buildable property by reference -- it's always copied either via merge or buildPartial and merge (MergeBuilderMethod).

Is there a reason setting by reference isn't supported? FreeBuilder types are immutable. 

Small example:

@FreeBuilder
interface Team { ... }


@FreeBuilder
interface Game {
 
Team away();
 
Team home();

}


The builder for Game will copy each Team reference that is set even though the Team is an immutable value type. So a collection of games ends up with many copies of the same Team objects.

Thanks!  

Alice Purcell

unread,
Dec 26, 2017, 7:34:58 PM12/26/17
to o...@fleaflicker.com, FreeBuilder
No, there is no reason other than that the feature is not yet implemented. (I mean, technically there's nothing stopping people making mutable FreeBuilder types, but I think it's still a sensible optimization.) Raised https://github.com/google/FreeBuilder/issues/270 to track. Thanks!

Alice

--
You received this message because you are subscribed to the Google Groups "FreeBuilder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to freebuilder...@googlegroups.com.
To post to this group, send email to freeb...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/freebuilder/62bd004d-8204-4e91-83fc-bb8d61ae67df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alice Purcell

unread,
Feb 2, 2018, 6:11:38 AM2/2/18
to FreeBuilder
Apologies for the lack of visible progress on this, Ori. I've actually implemented the feature but a lack of people willing to do code reviews on FreeBuilder is blocking all progress on the project at the moment.

Alice


On Wednesday, 27 December 2017 00:34:58 UTC, Alice Purcell wrote:
No, there is no reason other than that the feature is not yet implemented. (I mean, technically there's nothing stopping people making mutable FreeBuilder types, but I think it's still a sensible optimization.) Raised https://github.com/google/FreeBuilder/issues/270 to track. Thanks!

Alice

On Fri, 22 Dec 2017 at 15:01 <o...@fleaflicker.com> wrote:
I may have overlooked it but it there doesn't appear to be a way to set a buildable property by reference -- it's always copied either via merge or buildPartial and merge (MergeBuilderMethod).

Is there a reason setting by reference isn't supported? FreeBuilder types are immutable. 

Small example:

@FreeBuilder
interface Team { ... }


@FreeBuilder
interface Game {
 
Team away();
 
Team home();

}


The builder for Game will copy each Team reference that is set even though the Team is an immutable value type. So a collection of games ends up with many copies of the same Team objects.

Thanks!  

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

o...@fleaflicker.com

unread,
Feb 5, 2018, 9:11:38 AM2/5/18
to FreeBuilder
Awesome! Was not expecting this to be implemented any time soon. Doesn't look like a straightforward change because the builder implementation delegates to other builders.


On Friday, February 2, 2018 at 6:11:38 AM UTC-5, Alice Purcell wrote:
Apologies for the lack of visible progress on this, Ori. I've actually implemented the feature but a lack of people willing to do code reviews on FreeBuilder is blocking all progress on the project at the moment.

Alice

On Wednesday, 27 December 2017 00:34:58 UTC, Alice Purcell wrote:
No, there is no reason other than that the feature is not yet implemented. (I mean, technically there's nothing stopping people making mutable FreeBuilder types, but I think it's still a sensible optimization.) Raised https://github.com/google/FreeBuilder/issues/270 to track. Thanks!

Alice

On Fri, 22 Dec 2017 at 15:01 <o...@fleaflicker.com> wrote:
I may have overlooked it but it there doesn't appear to be a way to set a buildable property by reference -- it's always copied either via merge or buildPartial and merge (MergeBuilderMethod).

Is there a reason setting by reference isn't supported? FreeBuilder types are immutable. 

Small example:

@FreeBuilder
interface Team { ... }


@FreeBuilder
interface Game {
 
Team away();
 
Team home();

}


The builder for Game will copy each Team reference that is set even though the Team is an immutable value type. So a collection of games ends up with many copies of the same Team objects.

Thanks!  

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

Alice Purcell

unread,
Feb 5, 2018, 3:32:39 PM2/5/18
to o...@fleaflicker.com, FreeBuilder
Ok, you should be able to pick this up as v1.14.7 as soon as it gets distributed to your favourite OSS repo. Let me know how it works for you?

Alice

o...@fleaflicker.com

unread,
Feb 9, 2018, 9:31:20 AM2/9/18
to FreeBuilder
This is perfect, thanks for the quick turnaround. 
Reply all
Reply to author
Forward
0 new messages