You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Why passing/storing child models by references isn't a standart in Bubble Tea?
Now of course I can have references, but it doesn't make much sense while internal methods don't use pointer receivers (list.Update() for ex.), and vice versa it adds a lot of ugly cause models are not intended to be used by references, New() for ex. return value.
Using references leads to simplicity - now we should always update value of model, have separate field to indicate that it's active, but just with pointer receiver we will be able to do this in main.Update():
Models often is big (list.Model is big enough), so there is also a performance reason. And in the end, interfaces in Go love references, interface is reference, passing a value to interface results in another copy, where Go store value internally and anyway takes reference to it for interface value.
So, isn't changing this standard a good idea for the Bubble Tea v2, or is there some reason that I don't understand why this's done in that way?
I'm also curious about this. AFAICT the reason for using copies is immutability: ie there's no risk of concurrent changes to the model and that is a pretty compelling reason. Wondering what can be done to avoid copying large objects though
I was surprised that the List model is about 20k in size
Passing it around as reference would be more efficient. Is the suggestion to embed sub-models as references instead?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi! Why passing/storing child models by references isn't a standart in Bubble Tea?
Now of course I can have references, but it doesn't make much sense while internal methods don't use pointer receivers (
list.Update()for ex.), and vice versa it adds a lot of ugly cause models are not intended to be used by references,New()for ex. return value.Using references leads to simplicity - now we should always update value of model, have separate field to indicate that it's active, but just with pointer receiver we will be able to do this in
main.Update():Models often is big (
list.Modelis big enough), so there is also a performance reason. And in the end, interfaces in Go love references, interface is reference, passing a value to interface results in another copy, where Go store value internally and anyway takes reference to it for interface value.So, isn't changing this standard a good idea for the Bubble Tea v2, or is there some reason that I don't understand why this's done in that way?
All reactions