https://kotlinlang.org logo
#compose
Title
# compose
s

Sam

10/05/2020, 7:51 AM
Can someone from the core team share insight on the reason for the name change? Coming from SwiftUI, Stack is quite familiar nomenclature!
👍 1
b

Bsn Net

10/05/2020, 8:43 AM
Yes stack is good name
m

matvei

10/05/2020, 10:15 AM
There is a bunch of reasons for that change. • There's no good proper name for the concept of layout that stacks children in Z axis. It's called
FrameLayout
in android, ZStack in swiftui etc. We received some feedback that people expect Stack to be vertical, or even horizontal. People have different backgrounds and different expectation from that name. Overall we've decided that being 100% semantically correct is not worth it, and just having simple name for a simple concept will work just fine, hence
Box
. • We wanted to reduce number of APIs for general layouts. People used Box as a modifier wrapper or even as a leaf node with just modifiers on it. Sometimes they used Box to wrap many children as well. Name
Box
can be both (layouts that overlays children AND thing that you apply modifiers), allowing us to reduce complexity be reducing amount of API for people to learn. Stack wasn't striking us as smth that would read nicely without children. • We can concentrate on one thing performance wise and tune it nicely as we expect Box to be used quite regularly. • it's shorter to type (2 chars saved! 😛 )
🙌 13
👎 1
a

Archie

10/05/2020, 11:06 AM
Just an opinion:
Box
doesn't really feel like it states its purpose. I understand that it
Stack
may mean
VerticalStack
(Column) and/or
HorizontalStack
(Row) but
Box
seems even more confusing. I feel like naming it
ZStack
like in
SwiftUI
makes the purpose much more clear compared to naming it
Box
.
👍 3
g

gildor

10/05/2020, 11:37 AM
doesn’t really feel like it states its purpose
but there are different purposes for it
s

sindrenm

10/06/2020, 1:51 PM
Copy code
typealias Stack = Box
👍 1