Inline Functions: inline, crossinline, and noinline

  Рет қаралды 6,589

Dave Leeds

Dave Leeds

Күн бұрын

Пікірлер: 35
@erfansn869
@erfansn869 7 ай бұрын
Best kotlin channel
@gekylafas
@gekylafas 7 ай бұрын
Great examples! The table at the end summed everything up very nicely!
@Tuligarnio
@Tuligarnio 7 ай бұрын
The best explanation I've seen on this topic!
@hameedchishti3114
@hameedchishti3114 2 ай бұрын
best kotlin channel. Any plans to add inline, crossinline, noinline, reified material to your book?
@typealias
@typealias 2 ай бұрын
Hey, Hameed! Thanks so much! For the book, the objective was to get the reader to the point where he or she could be productive with Kotlin day-to-day, so I've intentionally left out some of the things that are mainly concerned with optimization (value classes are another feature that I love, but just didn't quite fit the objective, so I left them out). So, they won't be included in the Illustrated Guide - however, I'll still be writing (and drawing!) about Kotlin features as standalone articles on the website, and if there's enough interest in that topic, I'd be happy to write that one!
@abhijeetmutum3956
@abhijeetmutum3956 7 ай бұрын
I'd love to see you do a video on diving deeper into Kotlin coroutines and exploring various advanced concepts - your teaching style would surely make it easy to understand.Your Kotlin tutorials are incredibly clear and helpful, making learning the language a breeze!
@typealias
@typealias 7 ай бұрын
Thanks, Abhijeet! Great suggestion! I'm currently working on the final chapter of the Illustrated Guide, which covers the essentials of coroutines. As I'm doing that, I expect I'll create some videos that either tie in with it, or which cover related concepts that go beyond the essentials. 👍
@emiliomarkgraf7169
@emiliomarkgraf7169 7 ай бұрын
Hello 🙂 I really like your videos - they are informative and touch subjects I do not know much about, and you have a pleasant voice to listen to. Thank you for taking your time to educate people!
@typealias
@typealias 7 ай бұрын
Hey Emilio, you're most welcome! And thank you - I truly enjoy creating these videos!
@osisuper98
@osisuper98 5 ай бұрын
Thank God I discovered this channel. You rock!
@typealias
@typealias 5 ай бұрын
Hey, thanks so much! I'm glad you're enjoying it!
@Maxwork82
@Maxwork82 7 ай бұрын
Finally, it was a great explanation. Majority of sophisticated computer science topics are essential once somebody explains it to you.
@alanmeanam
@alanmeanam 5 ай бұрын
This guy is amazing, explains everything so clearly
@typealias
@typealias 5 ай бұрын
Thanks so much, Alan!
@amitbhandari1176
@amitbhandari1176 7 ай бұрын
Thanks, video is really helpful and good examples along the way to demonstrate actual usage!
@Guilo583
@Guilo583 7 ай бұрын
Thanks for the great explanation. could you please also explained reified key word
@typealias
@typealias 7 ай бұрын
Great suggestion! I'll add that to the list of possible future topics. 👍
@gb_kash
@gb_kash 5 ай бұрын
So beautifully explained. Thanks a lot
@flyhighflyfast
@flyhighflyfast 11 күн бұрын
best explanation
@martinuslukas448
@martinuslukas448 7 ай бұрын
Hello, I just bought your book, I think your explanation is very easy to understand.
@typealias
@typealias 7 ай бұрын
Hey Martinus, thank you so much! The funds from each purchase of the book have gone back into tooling and services that help me to create more articles and videos - so I really appreciate it!
@Amejonah
@Amejonah 7 ай бұрын
1:26 As of 1.5 Kotlin has the option to generate lambdas using invokedynamic instead of classes, in 2.0 this behavior will be activated per default. You forgot to mention that inline functions also allow reified generics! But overall, very nice explanation. I will reference your video to others in need. Keep it up 🫡
@typealias
@typealias 7 ай бұрын
Thanks for mentioning this! I hadn't read the 2.0-RC1 release notes yet, so I'm glad to hear that this will become the default behavior in 2.0! Also - the omission of reified type parameters was quite intentional - that's a big enough topic for its own video, so we'll tackle that another time. 🙂 Thanks again!
@eslambasher5720
@eslambasher5720 4 ай бұрын
thanks for explain every things easily but I have a question where function save came form ?
@typealias
@typealias 4 ай бұрын
Hey Eslam - The save() function was hiding inside the code folding (if you look at the numbers on the left-hand side, you'll see they go from 1 to 9, because I folded lines 1-8). The implementation of the save() function was irrelevant to the main focus of the video, but in case you're wondering, it just does Thread.sleep() for a random amount of time between 0-500ms.
@eslambasher5720
@eslambasher5720 4 ай бұрын
@@typealias thanks 🙏
@HarrisAli-rx6uy
@HarrisAli-rx6uy 6 ай бұрын
Perfect explanation, thank you :)
@typealias
@typealias 6 ай бұрын
You're most welcome!
@cya3mdirl158
@cya3mdirl158 23 күн бұрын
However, it’s still code interpreted by the JVM. What does this code look like after JIT optimization?
@gamarmustafa
@gamarmustafa 5 ай бұрын
great video as always!
@faridguliyev8417
@faridguliyev8417 7 ай бұрын
Finally, i understood this concept, thank you so much!
@eslambasher5720
@eslambasher5720 4 ай бұрын
I tried to use noinline parameter but when I saw the bytecode I found both of parameters inline and noinline both of them dont' make a new object why if there is one of them is noinline
@typealias
@typealias 4 ай бұрын
When you compile an inline function, you'll notice it show up in the bytecode (or in Java that you got when decompiling that bytecode) for interoperability with Java. If you call an inline function from Java, it'll call this function - that call won't be inlined, but it'll still work. That function is not called from your Kotlin code, though - it's only there for Java interop. For the Kotlin side, you'll see different bytecode depending on your version of Kotlin - - In Kotlin 1.x, you'll see something like (Function0)null.INSTANCE to represent the noinline argument. - In Kotlin 2.x, your noinline argument is generated as a static function (e.g., private static final Unit main$lambda$2()), and your call site will reference that.
@eslambasher5720
@eslambasher5720 4 ай бұрын
Thanks that's great
@bluediamond1965
@bluediamond1965 2 ай бұрын
I think default inline is just a suggestion to the compiler and cannot be enforced
Kotlin Code Reuse: Composing like you're Inheriting
14:42
Dave Leeds
Рет қаралды 10 М.
FULL Guide to Kotlin's Inline Keyword (inline, crossinline & noinline)
16:35
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 159 МЛН
бабл ти гель для душа // Eva mash
01:00
EVA mash
Рет қаралды 10 МЛН
Fun with Function Types in Kotlin
11:35
Dave Leeds
Рет қаралды 3,3 М.
5 Fun Ways to Use Extension Functions in Kotlin
18:46
Dave Leeds
Рет қаралды 13 М.
Kotlin Multiplatform vs Flutter: Which should we use?
4:42
Kei Fujikawa
Рет қаралды 26 М.
Subtyping Composables - TypeAlias Show Clip
7:01
Dave Leeds
Рет қаралды 2,8 М.
The Essence of Coroutines
8:10
Dave Leeds
Рет қаралды 12 М.
Reified Type Parameters
10:15
Dave Leeds
Рет қаралды 4,3 М.
Three Simple Rules for Subtypes
13:52
Dave Leeds
Рет қаралды 2,8 М.
Every Kind of Class in Kotlin
10:44
Dave Leeds
Рет қаралды 14 М.
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 159 МЛН