napperley
05/21/2019, 11:11 PM// ...
StoryWidget {
story = StoryData
Clickable {
onClick = onClick
Padding {
amount = 8.dp
Column {
Title { txtContent = story.title }
Image { src = story.image }
Text { txtContent = story.content }
}
}
}
}
Chuck Jazdzewski [G]
05/21/2019, 11:22 PMonClick = onClick
It might be clear you that the onClick
you are setting is the Clickable::onClick
but does right-hand onClick
refer to the readable value of the Clickable::onClick
or some outer scope onClick
. Does it require onClick@MyWidget
to disambiguate?
Also, we want to be able to skip the call to Clickable
if all the values passed to it are the same. If you can mix in statements it becomes unclear what can be skipped and what cannot be.
The function call syntax already resolves these issues by having a parameters.napperley
05/21/2019, 11:27 PMonClick = onClick
should be onClick = onClick@MyWidget
which isn't ambiguous.Chuck Jazdzewski [G]
05/21/2019, 11:31 PMnapperley
05/21/2019, 11:32 PMChuck Jazdzewski [G]
05/21/2019, 11:32 PMStoryWidget(story = story) {
Clickable(onClick = onClick) {
Padding(amount = 8.dp) {
Column {
Title(text = story.title)
Image(src = story.image)
Text(text = story.content)
}
}
}
}
Padding {
if (indented) amount = 8.dp
}
What is unclear is what happens when indented
turns from true
to false
? It is unclear what to do with this as it needs to "unset" the value amount
. The current syntax never gets into this situation.napperley
05/21/2019, 11:41 PM// ...
StoryWidget {
val newAuthor = "$firstName $lastName"
validateAuthor(newAuthor)
author = newAuthor
story = StoryData
onClick = onClick@MyWidget
Padding {
amount = 8.dp
Column {
Title { txtContent = story.title }
Image { src = story.image }
Text { txtContent = story.content }
}
}
}
Chuck Jazdzewski [G]
05/21/2019, 11:44 PMval newAuthor
can be lifted one level and you get:
val newAuthor = "$firstName $lastName"
StoryWidget(author = newAuthor, story = story) {
...
}
StoryWidget(author = "$firstName $lastName", ...) {
...
}
gildor
05/22/2019, 12:30 AMbdawg.io
05/22/2019, 1:08 AMnapperley
05/22/2019, 2:07 AMcedric
05/22/2019, 2:49 AMText()
and others return Unit
is not exactly functional.streetsofboston
05/22/2019, 2:58 AMIO<Unit>
of the function it annotates.cedric
05/22/2019, 3:03 AMthemishkun
05/22/2019, 5:04 AMrun
block when passing parameter, or make all of the calculations beforehandraulraja
05/22/2019, 7:28 AMthemishkun
05/22/2019, 8:32 AM@Compose
annotation adds implicit argument that handles all of the memoization and computationsraulraja
05/22/2019, 9:01 AMgildor
05/22/2019, 9:02 AMthemishkun
05/22/2019, 9:10 AMraulraja
05/22/2019, 9:13 AMcedric
05/22/2019, 5:38 PMnapperley
05/22/2019, 10:58 PMFudge
05/23/2019, 8:50 AM@Composable
is just a few syntactic sugar improvementsnapperley
05/23/2019, 9:11 PMbdawg.io
05/23/2019, 9:37 PMgildor
05/24/2019, 12:46 AMthemishkun
05/24/2019, 6:49 AM@
suppose to reduce "magic"?bdawg.io
05/24/2019, 7:04 AMgildor
05/24/2019, 7:05 AMbdawg.io
05/24/2019, 7:05 AMgildor
05/24/2019, 7:06 AMbdawg.io
05/24/2019, 7:07 AMcompiler plugins make them a much better experience to use than kapt....without a need for a new source code paradigm
gildor
05/24/2019, 7:07 AM