What is the official name of these `@Composable` f...
# compose
m
What is the official name of these
@Composable
functions (or result that they create on UI tree)? Widget, node, component or else?
l
ComponentNode
?
j
I've been calling them "composables" (short for composable functions). I've also seen the terms "widget" and "component" used.
Node is probably more often used to describe the emittables (leaf nodes of a call tree) lower down in the Compose tech stack, so I personally/internally probably wouldn't use that word to describe the composables that users would see/use.
l
I was addressing the
result that they create on UI tree
part šŸ˜›
m
I preffer Widget. But creators should decide, also for sake of future documentation.
j
Haha, well, in that case,
emittable
or
node
is perfectly reasonable šŸ™‚
@Michal Bacik Well, I frequently use widget in conversation, so yeah, that's a fine word too.
šŸ‘Œ 1
l
Someone here in the channel (🧌 ) doesn’t like more than 1 way to address things, so, first thing first: set a name and make it const val
šŸ¤” 1
m
@Luca Nicoletti Absolutely agree. We all know what
View
is, so it should be crystal clear what single item is in Compose UI.
l
If you refer to the code, then
Emittable
and its implementations are what you’re looking for
I was trolling 🧌, I’m fine with being able to address to them with different names
p
May I ask what is emitted in this case? is it drawing commands to the GPU?
m
@Luca Nicoletti I don't mean how actual implementation class is named, we don't ever meet
Emittable
. We're given
@Composable
annotation, that's all that is common for these "widgets".
@Pablichjenkov I'm not sure if these widgets are directly using GPU. They get chance to draw to Canvas, actually clipped rectangle on it. The Canvas is as big as the activity window. Or not?
j
@Pablichjenkov Compose bottoms out at Emittables, which are base nodes in the given view system. For example, Compose will bottom out when it hits an AndroidView (like a WebView or ViewGroup) in the hierarchy. It will also bottom out when it hits a
LayoutNode
(which is a
ComponentNode
) that ComposeUI uses to determine positioning and clipping information.
l
compose UI’s emittables are
ComponentNode
and its subclasses
and fwiw, i’ve been trying to use ā€œcomposableā€ or ā€œcomposable functionā€ when describing composable functions
ā€œcomponentā€ is also a term i find myself using a lot, mostly due to its relation to ā€œreact componentā€ and i think it’s a reasonable vernacular depending on who you’re talking to
šŸ‘Œ 1
p
ComponentNode
šŸ¤” interesting. Thank you all. Is there any documentation about how the measurement and layout of these Nodes work yet? Just for general culture.
l
check out Layout.kt and corresponding documentation on DAC
šŸ‘ 1
p
Thanks one more time
f
Someone here in the channel (🧌 ) doesn’t like more than 1 way to address things, so, first thing first: set a name and make it const val
It’s nice to know my principles are holding up. There should be an agreed way to address it. Widget is for Flutter , Component is for react, composable has too many syllables, so there isn’t a best answer I can suggest though.
If you would press me against a wall I would say component
p
But then it will remind you of React.
Emittable
sounds very streamish. Still open in the air 😸
l
i am loving the snark that is emerging out of this slack channel lol
ā¤ļø 1
Emittable is a specific term that is distinct from composable functions
it means the elements of the actual tree that compose builds
and a @Composable function is not one of those elements, so Emittable isn’t up for grabs here
p
Composable
fair enough.
r
@jim @Leland Richardson [G] Widget is already too overloaded on Android
l
View
🧌
m
Compo
šŸ™‚