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?
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
-
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?
Beta Was this translation helpful? Give feedback.
All reactions