The document discusses various Kotlin language features and how they are compiled down to bytecode. It explains concepts like lowering, de-sugaring, and decompiling Kotlin programs. Specific language features summarized include free functions, nested functions, extension methods, data classes, object declarations, companion objects, and lambdas with receivers. The document shows how each feature compiles by decompiling example Kotlin code.
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016STX Next
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice for Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, on one hand covering major advantages for developers and keeping short compile times on the other.
This presentation is a Developer Starter - a set of hand-picked information allowing a person with no knowledge of Kotlin to start writing basic Android activities and set up a kotlin-based Android project. It starts with language background, reasons for its creation and advantages. Then presents basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin compilation is presented and the language is compared to SCALA and SWIFT.
StxNext Lightning Talks - Feb 12, 2016
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice when it comes to Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, on one hand covering major advantages for developers and on the other - keeping short compile times.
This presentation is a Developer Starter - a set of hand-picked information allowing a person with no knowledge of Kotlin to start writing basic Android activities and set up an Android-kotlin project. It starts with language background, reasons for its creation and advantages. Then presents basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin usage is presented and the language is compared to SCALA and SWIFT.
Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...Tudor Dragan
Kotlin is a powerful language, but it also comes with its traps and pitfalls. This presentation is about uncovering the very nice features and strange particularities that the language has to offer.
Kotlin is a JVM language developed by Jetbrains. Its version 1.0 (production ready) was released at the beginning of the year and made some buzz within the android community. This session proposes to discover this language, which takes up some aspects of groovy or scala, and that is very close to swift in syntax and concepts. We will see how Kotlin boosts the productivity of Java & Android application development and how well it accompanies reactive development.
Android Developer Group Poznań - Kotlin for Android developers
STXInsider example project in Kotlin:
https://github.com/kosiara/stx-insider
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice for Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, has clear benefits for developers on one hand and keeps short compile times on the other.
As a mobile team we got interested in Kotlin a few months before its final release which gave us time to test it thoroughly before production use. The language has some clear advantages for an Android programmer - it enables migration from Java projects that have been under development for some time already. Java&Kotlin coexistence simplifies Kotlin introduction as only new functionality is written in JetBrain’s new language leaving all the legacy code untouched.
Transitioning gives the developer an opportunity to use lambdas, new syntax for data objects, extension functions to easily expand Android SDK’s classes functionality and infix notation to write DSL-like structures. Almost all the libraries you use today will work with Kotlin thanks to 100% Java compatibility. The same is true for Android SDK classes - all of them will seamlessly work with the new programming language. Kotlin gives you more choice when it comes to reflection, creating documentation and being null-pointer safe. Android works great with it out of the box so you won’t need to change your development habits.
Our production project in Kotlin turned out to be a success after 4 months of development. We had 0 bugs related to Kotlin as a programming language. Our code footprint is almost 30% smaller thanks to JetBrain’s, we benefit from nullpointer safety, closures, translated enums, data objects and use infix notation for logging and displaying Snackbars.
===========
In this presentation you'll find basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin compilation is presented and the language is compared to SCALA and SWIFT.
We look at the positive impact new syntax can have on boilerplate removal and readability improvement.
Kotlin really shines in Android development when one looks at “Enum translation”, “Extension functions”, “SAM conversions”, “Infix notation”, “Closures” and “Fluent interfaces” applied to lists. The talk, however, compares language-specifics of Java & Kotlin in terms of “Type Variance”, “Generics” and “IDE tools” as well.
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016STX Next
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice for Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, on one hand covering major advantages for developers and keeping short compile times on the other.
This presentation is a Developer Starter - a set of hand-picked information allowing a person with no knowledge of Kotlin to start writing basic Android activities and set up a kotlin-based Android project. It starts with language background, reasons for its creation and advantages. Then presents basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin compilation is presented and the language is compared to SCALA and SWIFT.
StxNext Lightning Talks - Feb 12, 2016
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice when it comes to Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, on one hand covering major advantages for developers and on the other - keeping short compile times.
This presentation is a Developer Starter - a set of hand-picked information allowing a person with no knowledge of Kotlin to start writing basic Android activities and set up an Android-kotlin project. It starts with language background, reasons for its creation and advantages. Then presents basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin usage is presented and the language is compared to SCALA and SWIFT.
Kotlin - The Swiss army knife of programming languages - Visma Mobile Meet-up...Tudor Dragan
Kotlin is a powerful language, but it also comes with its traps and pitfalls. This presentation is about uncovering the very nice features and strange particularities that the language has to offer.
Kotlin is a JVM language developed by Jetbrains. Its version 1.0 (production ready) was released at the beginning of the year and made some buzz within the android community. This session proposes to discover this language, which takes up some aspects of groovy or scala, and that is very close to swift in syntax and concepts. We will see how Kotlin boosts the productivity of Java & Android application development and how well it accompanies reactive development.
Android Developer Group Poznań - Kotlin for Android developers
STXInsider example project in Kotlin:
https://github.com/kosiara/stx-insider
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice for Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, has clear benefits for developers on one hand and keeps short compile times on the other.
As a mobile team we got interested in Kotlin a few months before its final release which gave us time to test it thoroughly before production use. The language has some clear advantages for an Android programmer - it enables migration from Java projects that have been under development for some time already. Java&Kotlin coexistence simplifies Kotlin introduction as only new functionality is written in JetBrain’s new language leaving all the legacy code untouched.
Transitioning gives the developer an opportunity to use lambdas, new syntax for data objects, extension functions to easily expand Android SDK’s classes functionality and infix notation to write DSL-like structures. Almost all the libraries you use today will work with Kotlin thanks to 100% Java compatibility. The same is true for Android SDK classes - all of them will seamlessly work with the new programming language. Kotlin gives you more choice when it comes to reflection, creating documentation and being null-pointer safe. Android works great with it out of the box so you won’t need to change your development habits.
Our production project in Kotlin turned out to be a success after 4 months of development. We had 0 bugs related to Kotlin as a programming language. Our code footprint is almost 30% smaller thanks to JetBrain’s, we benefit from nullpointer safety, closures, translated enums, data objects and use infix notation for logging and displaying Snackbars.
===========
In this presentation you'll find basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin compilation is presented and the language is compared to SCALA and SWIFT.
We look at the positive impact new syntax can have on boilerplate removal and readability improvement.
Kotlin really shines in Android development when one looks at “Enum translation”, “Extension functions”, “SAM conversions”, “Infix notation”, “Closures” and “Fluent interfaces” applied to lists. The talk, however, compares language-specifics of Java & Kotlin in terms of “Type Variance”, “Generics” and “IDE tools” as well.
After reimplement many features several times in different platforms is time to think that it should be a better way. There are many frameworks that allows the developers to write the code once and deploy it "everywhere", but the final result is an app with a non native look and feel or with an emulated look and feel that the users can see and rate according to the quality.
There are other ways to develop apps for multiple platforms without rewriting the same code over and over. I'll talk about one of that ways which consists on developing the core with C++ and implement the UI natively. This method could sound very scary because of the C++ reputation (memory leaks, the standard library, etc), but with C++11 all this has been improved in a very sweet way, so maybe it is time to take an other look at this language and see how can we take advantage of it.
Slides from a talk and live-coding session about Koin, a pragmatic and lightweight Dependency Injection framework for Kotlin. This talk was given at Auckland Android Community on Dec 5.
https://www.meetup.com/Android-Meetup/events/256734688/
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
HotSpot promises to do the "right" thing for us by identifying our hot code and compiling "just-in-time", but how does HotSpot make those decisions?
This presentation aims to detail how HotSpot makes those decisions and how it corrects its mistakes through a series of demos that you run yourself.
Kotlin provides a modern, statically-typed, and expressive alternative to Java, offering null safety, coroutines for asynchronous programming, and a succinct, intuitive syntax.
This presentation will give an introduction to Kotlin, looking at various language features, how those features are utilized by the Kotlin Standard Library, and how they are implemented in performance-conscious ways.
What features of modern programming languages allow you to maximise creativity and express solutions to problems elegantly and efficiently. This is a summary of features of the latest languages and how they help.
After reimplement many features several times in different platforms is time to think that it should be a better way. There are many frameworks that allows the developers to write the code once and deploy it "everywhere", but the final result is an app with a non native look and feel or with an emulated look and feel that the users can see and rate according to the quality.
There are other ways to develop apps for multiple platforms without rewriting the same code over and over. I'll talk about one of that ways which consists on developing the core with C++ and implement the UI natively. This method could sound very scary because of the C++ reputation (memory leaks, the standard library, etc), but with C++11 all this has been improved in a very sweet way, so maybe it is time to take an other look at this language and see how can we take advantage of it.
Slides from a talk and live-coding session about Koin, a pragmatic and lightweight Dependency Injection framework for Kotlin. This talk was given at Auckland Android Community on Dec 5.
https://www.meetup.com/Android-Meetup/events/256734688/
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
HotSpot promises to do the "right" thing for us by identifying our hot code and compiling "just-in-time", but how does HotSpot make those decisions?
This presentation aims to detail how HotSpot makes those decisions and how it corrects its mistakes through a series of demos that you run yourself.
Kotlin provides a modern, statically-typed, and expressive alternative to Java, offering null safety, coroutines for asynchronous programming, and a succinct, intuitive syntax.
This presentation will give an introduction to Kotlin, looking at various language features, how those features are utilized by the Kotlin Standard Library, and how they are implemented in performance-conscious ways.
What features of modern programming languages allow you to maximise creativity and express solutions to problems elegantly and efficiently. This is a summary of features of the latest languages and how they help.
Generics On The JVM (What you don't know will hurt you)Garth Gilmour
Talk delivered to the London Kotlin Users Group. Covering how generics is implemented on the JVM and the different approaches taken by Java and Kotlin to co/contra variance and the lack of reified types.
Using Kotlin, to Create Kotlin,to Teach Kotlin,in SpaceGarth Gilmour
Talk delivered at the Kotliners 2020 conference. Covering how Instil used the Kotlin Space DSL to automatically populate Space instances used in coding workshops.
Transitioning Android Teams Into KotlinGarth Gilmour
Talk delivered with Eamonn Boyle at GOTO Copenhagen in 2019. Covering how best to move from delivering Android projects in Java to writing the code in Kotlin.
Simpler and Safer Java Types (via the Vavr and Lambda Libraries)Garth Gilmour
Lightning talk delivered at the Belfast Java Users Group on 21st August 2019. The accompanying code can be found here - https://bitbucket.org/GarthGilmour/java-typing-bjug-aug-2019
'Full Stack Kotlin' Workshop at KotlinConfGarth Gilmour
Slides from my workshop on 'Building a Full Stack Web App in Kotlin'. Note these are only talking points, the full set of materials is available at:
https://gitlab.com/instil-training/kotlinconf-workshop-2018
FFS The Browser and Everything In It Is Wrong - We've Ruined Software Enginee...Garth Gilmour
Slides from my presentation to FFSTechConf (https://ffstechconf.org/). The full transcript is available at https://docs.google.com/document/d/e/2PACX-1vQUGG28baEuS7RgpPpexNbxRxJfjzc6r43yhZoLF_56n7aacke-uVEdNVQxvkPf1NxsEuJfkMK0MCvi/pub
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
What is Augmented Reality Image Trackingpavan998932
Augmented Reality (AR) Image Tracking is a technology that enables AR applications to recognize and track images in the real world, overlaying digital content onto them. This enhances the user's interaction with their environment by providing additional information and interactive elements directly tied to physical images.
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...kalichargn70th171
A dynamic process unfolds in the intricate realm of software development, dedicated to crafting and sustaining products that effortlessly address user needs. Amidst vital stages like market analysis and requirement assessments, the heart of software development lies in the meticulous creation and upkeep of source code. Code alterations are inherent, challenging code quality, particularly under stringent deadlines.
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Hand Rolled Applicative User ValidationCode KataPhilip Schwarz
Could you use a simple piece of Scala validation code (granted, a very simplistic one too!) that you can rewrite, now and again, to refresh your basic understanding of Applicative operators <*>, <*, *>?
The goal is not to write perfect code showcasing validation, but rather, to provide a small, rough-and ready exercise to reinforce your muscle-memory.
Despite its grandiose-sounding title, this deck consists of just three slides showing the Scala 3 code to be rewritten whenever the details of the operators begin to fade away.
The code is my rough and ready translation of a Haskell user-validation program found in a book called Finding Success (and Failure) in Haskell - Fall in love with applicative functors.
Artificia Intellicence and XPath Extension FunctionsOctavian Nadolu
The purpose of this presentation is to provide an overview of how you can use AI from XSLT, XQuery, Schematron, or XML Refactoring operations, the potential benefits of using AI, and some of the challenges we face.
Transform Your Communication with Cloud-Based IVR SolutionsTheSMSPoint
Discover the power of Cloud-Based IVR Solutions to streamline communication processes. Embrace scalability and cost-efficiency while enhancing customer experiences with features like automated call routing and voice recognition. Accessible from anywhere, these solutions integrate seamlessly with existing systems, providing real-time analytics for continuous improvement. Revolutionize your communication strategy today with Cloud-Based IVR Solutions. Learn more at: https://thesmspoint.com/channel/cloud-telephony
OpenMetadata Community Meeting - 5th June 2024OpenMetadata
The OpenMetadata Community Meeting was held on June 5th, 2024. In this meeting, we discussed about the data quality capabilities that are integrated with the Incident Manager, providing a complete solution to handle your data observability needs. Watch the end-to-end demo of the data quality features.
* How to run your own data quality framework
* What is the performance impact of running data quality frameworks
* How to run the test cases in your own ETL pipelines
* How the Incident Manager is integrated
* Get notified with alerts when test cases fail
Watch the meeting recording here - https://www.youtube.com/watch?v=UbNOje0kf6E
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Łukasz Chruściel
No one wants their application to drag like a car stuck in the slow lane! Yet it’s all too common to encounter bumpy, pothole-filled solutions that slow the speed of any application. Symfony apps are not an exception.
In this talk, I will take you for a spin around the performance racetrack. We’ll explore common pitfalls - those hidden potholes on your application that can cause unexpected slowdowns. Learn how to spot these performance bumps early, and more importantly, how to navigate around them to keep your application running at top speed.
We will focus in particular on tuning your engine at the application level, making the right adjustments to ensure that your system responds like a well-oiled, high-performance race car.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Do you want Software for your Business? Visit Deuglo
Deuglo has top Software Developers in India. They are experts in software development and help design and create custom Software solutions.
Deuglo follows seven steps methods for delivering their services to their customers. They called it the Software development life cycle process (SDLC).
Requirement — Collecting the Requirements is the first Phase in the SSLC process.
Feasibility Study — after completing the requirement process they move to the design phase.
Design — in this phase, they start designing the software.
Coding — when designing is completed, the developers start coding for the software.
Testing — in this phase when the coding of the software is done the testing team will start testing.
Installation — after completion of testing, the application opens to the live server and launches!
Maintenance — after completing the software development, customers start using the software.
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
Looking for a reliable mobile app development company in Noida? Look no further than Drona Infotech. We specialize in creating customized apps for your business needs.
Visit Us For : https://www.dronainfotech.com/mobile-application-development/
2. – The K2 compiler previewed in 1.7
– Why you should care about it
– Looking inside the black box
– The concept of ‘lowering’
– Quick note on Android
– Other game changers
agenda
what’s new in Kotlin 1.7
6. – The interop story is so good
– Call into legacy Java code easily
– Call into JavaScript easily
– Call in C and Swift easily
– Really concise, yet clear syntax
– Less is more
– “Borrows” the best bits
– Less baggage
why kotlin?
so much to like
Null Safety
String Templates
Default parameters
Extensions
Free Functions
Coroutines
Single Expression Functions
Reified generics
Data classes and Properties
Type Inference
Smart Casts
Operator overloading
7. This is what we want Kotlin to become in the
future. The universal solution for every
platform.
ANDREY
BRESLAV
Former Lead Language Designer of Kotlin, JetBrains
9. the pre 1.7 approach
no unified back end
Front
End
Abstract Syntax
Tree (AST)
1101011111
001010110
101010110
Semantic Info
JVM
Back End
JS
Back End
Native
Back End
10. the 1.7 approach
unified back end
Back Ends
Front
End
Front IR
JVM Specific
JS Specific
LVVM Specific
Shared
IR
12. the 1.7 approach
– Consistency across different platforms
– Faster adoption of language features
– A universal API for compiler plugins
– Richer and more reliable tooling
– Improvements in compile times
benefits for developers
20. IrLowering: IR lowering
ValidateIrBeforeLowering: Validate IR before lowering
ProcessOptionalAnnotations: Record metadata of ...
ExpectDeclarationsRemoving: Remove expect declaration from ...
SerializeIr: If specified by compiler options ...
ScriptsToClasses: Put script declarations into classes ...
FileClass: Put file level function ...
JvmStaticInObject: Make JvmStatic functions ...
RepeatedAnnotation: Enclose repeated annotations ...
PerformByIrFile: Perform phases by IrFile ...
TypeAliasAnnotationMethodsLowering: Generate method stubs ...
FunctionExpression: Transform IrFunctionExpression to ...
JvmOverloadsAnnotation: Handle JvmOverloads annotations ...
MainMethodGeneration: Generate main bridges to ...
MakePropertyDelegateMethodsStatic: Make `$delegate` methods for ...
RenameFields: Rename private fields ...
FakeInliningLocalVariablesLowering: Add fake locals to identify the ...
GenerateMultifileFacades: Generate JvmMultifileClass facades ...
ResolveInlineCalls: Statically resolve calls to ...
BytecodeInliningPreparation: Label all loops for non-local ...
ValidateIrAfterLowering: Validate IR after lowering ...
lots more lowerings
22. summary of commands
kotlinc –X
kotlinc –Xlist-phases
kotlinc –Xphases-to-dump-after=ValidateIrAfterLowering <PATH>
list experimental arguments
list compiler phases
dump output when a phase is complete
23.
24.
25.
26. the Visitor Pattern in Kotlinc
interface IrElementVisitor<out R, in D> {
fun visitElement(element: IrElement, data: D): R
fun visitDeclaration(declaration: IrDeclarationBase, data: D): R
fun visitClass(declaration: IrClass, data: D): R
fun visitFunction(declaration: IrFunction, data: D): R
fun visitConstructor(declaration: IrConstructor, data: D): R
fun visitProperty(declaration: IrProperty, data: D): R
}
one visit method for every type of node
28. – Many language features are ‘syntactical sugar’
– They don’t add a capability but provide a convenience
– For example, a foreach loop rather than an Iterator object
lowering vs. de-sugaring
understanding the difference
29. – These language features can be de-sugared
– We rewrite more complex constructs as simpler ones
– Lowering is where we do this within the same language
lowering vs. de-sugaring
understanding the difference
30. – The Kotlin compiler uses lowerings internally
– To restrict its work to a subset of the language
– We cannot (yet) drill into these in detail
– But we can look at de-sugaring in general
lowering vs. de-sugaring
understanding the difference
31. – Nothing is ever hidden in software
– We can decompile bytecode from the Kotlin compiler
– This lets us see how Kotlin features work ‘under the hood’
– Similar options exist for other platforms
decompiling Kotlin programs
via the IntelliJ tools
32.
33. introducing javap
the java bytecode decompiler
% javap
Usage: javap <options> <classes>
where possible options include:
...
-p -private Show all classes and members
-c Disassemble the code
-s Print internal type signatures
...
--module-path <path> Specify where to find application modules
--system <jdk> Specify where to find system modules
...
-cp <path> Specify where to find user class files
...
36. public final class ProgramKt {
public static final void printMsg(String);
Code:
15: return
public static final void main();
Code:
5: return
public static void main(String[]);
Code:
3: return
}
free functions
46. class Person(val name: String)
fun Person.sayHello() = println("Hello from $name")
fun String.times(num: Int) = (1..num).joinToString { "$this" }
fun main() {
val person = Person("Jane")
person.sayHello()
println("Dave".times(3))
}
extension methods
Hello from Jane
Dave, Dave, Dave
47. public static final void sayHello(Person);
Code:
...
25: return
public static final String times(String, int);
Code:
...
40: return
extension methods
49. destructuring
data class Person(val name: String, val age: Int)
fun main() {
val person = Person("Lucy", 36)
val (x, y) = person
println(x)
println(y)
}
Lucy
36
50. destructuring
public final Person {
private final String name;
private final int age;
public Person(String, int);
public final String getName();
public final int getAge();
public final String component1();
public final int component2();
public final Person copy(String, int);
public static Person copy$default(Person, String, int, int, Object);
public java.lang.String toString();
public int hashCode();
public boolean equals(java.lang.Object);
}
51. destructuring
public final class ProgramKt {
public static final void main();
Code:
...
15: invokevirtual #18 // Person.component1:()String;
18: astore_2
19: aload_1
20: invokevirtual #22 // Person.component2:()I
23: istore_3
...
44: return
public static void main(java.lang.String[]);
Code:
0: invokestatic #46 // Method main:()V
3: return
}
54. object declarations
public final class Math {
public static final Math INSTANCE;
private Math();
public final int add(int, int);
static {};
Code:
0: new #2 // class Math
3: dup
4: invokespecial #17 // Method "<init>":()V
7: putstatic #20 // Field INSTANCE:Math;
10: return
}
55. object declarations
public final class ProgramKt {
public static final void main();
Code:
0: getstatic #12 // Field Math.INSTANCE:Math;
3: bipush 12
5: bipush 34
7: invokevirtual #16 // Method Math.add:(II)I
10: istore_0
11: iconst_0
12: istore_1
13: getstatic #22 // Field System.out;
16: iload_0
17: invokevirtual #28 // Method PrintStream.println:(I)V
20: return
public static void main(String[]);
}
57. class Employee(val name: String, val dept: String) {
companion object {
fun buildForHR(name: String) = Employee(name, "HR")
fun buildForIT(name: String) = Employee(name, "IT")
}
override fun toString() = "$name working in $dept"
}
fun main() {
val emp1 = Employee.buildForHR("Dave")
val emp2 = Employee.buildForIT("Jane")
println(emp1)
println(emp2)
}
companion objects
Dave working in HR
Jane working in IT
58. public final class Employee {
public static final Employee$Companion Companion;
private final String name;
private final String dept;
public Employee(String, String);
public final String getName();
public final String getDept();
public String toString();
static {};
Code:
0: new #45 // class Employee$Companion
3: dup
4: aconst_null
5: invokespecial #48 // Employee$Companion."<init>"
8: putstatic #52 // Field Companion:Employee$Companion;
11: return
}
companion objects
60. class Employee(val name: String, val dept: String) {
companion object EmployeeFactory {
fun buildForHR(name: String) = Employee(name, "HR")
fun buildForIT(name: String) = Employee(name, "IT")
}
override fun toString() = "$name working in $dept"
}
fun main() {
val emp1 = Employee.buildForHR("Dave")
val emp2 = Employee.buildForIT("Jane")
println(emp1)
println(emp2)
}
companion objects (renamed)
Dave working in HR
Jane working in IT
61. public final class Employee {
private final Ljava/lang/String; name
private final Ljava/lang/String; dept
public final static Employee$EmployeeFactory; EmployeeFactory
public toString()Ljava/lang/String;
public final getName()Ljava/lang/String;
public final getDept()Ljava/lang/String;
public <init>(Ljava/lang/String;Ljava/lang/String;)V
// access flags 0x8
static <clinit>()V
NEW Employee$EmployeeFactory
DUP
ACONST_NULL
INVOKESPECIAL Employee$EmployeeFactory.<init> (...)V
PUTSTATIC Employee.EmployeeFactory : Employee$EmployeeFactory;
RETURN
MAXSTACK = 3
MAXLOCALS = 0
}
companion objects (renamed)
63. class Person(val name: String, job: String) {
var job: String by LoggingDelegate(job)
}
fun main() {
val person = Person("Jane", "Junior Developer")
person.job = "Senior Developer"
println(person.job)
}
Delegated Properties
Creating logger for property 'job'
Writing to 'job'
Reading from 'job'
Senior Developer
64. class LoggingDelegate<T>(var value: T) : ReadWriteProperty<Any?, T> {
operator fun provideDelegate(
thisRef: Any?,
prop: KProperty<*>
): ReadWriteProperty<Any?, T> {
println("Creating logger for property '${prop.name}'")
return this
}
override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) {
println("Writing to '${property.name}'")
this.value = value
}
override fun getValue(thisRef: Any?, property: KProperty<*>): T {
println("Reading from '${property.name}'")
return value
}
}
Delegated Properties
65. public final class Person {
...
private final Lkotlin/properties/ReadWriteProperty; job$delegate
public <init>(Ljava/lang/String;Ljava/lang/String;)V
...
NEW language/delegated/properties/LoggingDelegate
...
Delegated Properties
69. data class Person(val name: String, var age: Int)
fun demo(person: Person, action: Person.() -> Unit) = person.apply(action)
fun main() {
val person = Person("Jane", 25)
demo(person) {
age += 10
println(this)
}
}
lambdas with receivers
Person(name=Jane, age=35)
70. public final class ProgramKt {
public static final Person demo(
Person,
kotlin.jvm.functions.Function1<? super Person, kotlin.Unit>
);
Code:
...
21: invokeinterface #24,2 //Function1.invoke:(Object;)Object;
...
public static final void main();
Code:
...
13: getstatic #42 // Field ProgramKt$main$1.INSTANCE:ProgramKt$main$1;
16: checkcast #20 // class kotlin/jvm/functions/Function1
19: invokestatic #44 // Method demo:(Person;Function1;)Person;
...
lambdas with receivers
71. public interface Function1<P1, R> extends Function<R> {
public abstract R invoke(P1);
}
lambdas with receivers
javap -cp kotlin-stdlib-1.5.10.jar -c -p kotlin.jvm.functions.Function1
public interface kotlin.Function<R> {
}
javap -cp kotlin-stdlib-1.5.10.jar -c -p kotlin.jvm.functions.Function
72. public interface Function2<P1, P2, R> extends Function<R> {
public abstract R invoke(P1, P2);
}
lambdas with receivers
javap -cp kotlin-stdlib-1.5.10.jar -c -p kotlin.jvm.functions.Function2
public interface Function3<P1, P2, P3, R> extends Function<R> {
public abstract R invoke(P1, P2, P3);
}
javap -cp kotlin-stdlib-1.5.10.jar -c -p kotlin.jvm.functions.Function3
75. fun demo(
person: Person,
action: EvilLambda
) = person.action(1, 2, 3, 4 ... 14, 15, 16, 17, 18, 19, 20, 21)
fun main() {
val person = Person("Jane", 25)
demo(person) { a, b, c, d ... n, o, p, q, r, s, t, u ->
age += 10
println(this)
}
}
lambdas with receivers (21+1 params)
79. fun demo(
person: Person,
action: EvilLambda
) = person.action(1, 2, 3, 4 ... 14, 15, 16, 17, 18, 19, 20, 21, 22)
fun main() {
val person = Person("Jane", 25)
demo(person) { a, b, c, d ... n, o, p, q, r, s, t, u, v ->
age += 10
println(this)
}
}
lambdas with receivers (22+1 params)
82. – A new predictive back gesture
– Enables users to see where ‘back’ will take them
Android 13
opt-in on back behaviour
83. – Open-source application, in Kotlin and Compose
– Designed to show (Googles view on) best practices
Android 13
‘Now in Android’
84. – API is now stable
– Performance improvements are promised
– Recomposition highlighter to find poorly optimised views
– Lazy Layouts for efficiently showing lists of items
Android 13
Compose 1.2 Beta
85. – Allows classes and methods to be precompiled
– These are bundled with your release to speed startup
– Most crucial user journeys profiled via Macrobenchmark
Android 13
Baseline Profiles
86. – Edit and observe changes to composable functions
– Will significantly simplify and speed up UI development
– Works on previews, emulators and devices
– But still a work in progress
Android 13
Live Edit
88. game changer 1
multiplatform libraries
COMMON
KOTLIN
KOTLIN ANDROID
KOTLIN JS
KOTLIN NATIVE
KOTLIN JVM
NATIVE
ARTEFACT
JS BUNDLE
JAR
89. – Union Types with ‘|’ syntax
– Improvements to Sealed Types
– Extended Operator Overloading
– Name based Destructuring
– Collection Literals
– Structure Literals (Tuples?)
game changer 2
potential new language features
90. – Brings Google’s UI Toolkit to web
– In theory, enables reuse of UI code across stack
game changer 3
compose for web
https://compose-web.ui.pages.jetbrains.team/
Div(attrs = attrs) {
Label {
Input(
type = InputType.Checkbox,
attrs = {}
)
Span {
content()
}}}
92. – Kotlin is emerging from a period of consolidation
– Which opens the door to lots of good things
– Better tooling, new features, faster builds etc...
– Android continues to innovate on top of Kotlin
– Compose could be ‘one DSL to rule them all’
conclusions
...great things lie ahead