Hacker News new | ask | show | jobs
by ericweyant 4057 days ago
Anvil looks really promising. I wonder why doesn't it use "linearLayout {}" instead "v<LinearLayout> {}" syntax?
1 comments

I'd guess because Anvil began as a Java project, and Kotlin is what provides the sugar that allows Anko to provide a nice DSL.
Almost correct. I never thought of this kind of syntax sugar initially. But technically (and people posted an issue about it) it's possible to generate functions like linearLayout() etc from android.jar for Anvil/Java. This will work with Anvil/Kotlin as well.

I plan to keep v<Class> anyway because it works nice with custom views when there is no generated syntax sugar.