This might be a dumb question but where are the me...
# getting-started
f
This might be a dumb question but where are the method bodies for the operators functions inside Primitives.kt
k
As I said (https://kotlinlang.slack.com/archives/C0B8MA7FA/p1561059246214900?thread_ts=1560978823.192000&cid=C0B8MA7FA), they don't have bodies, they're compiler intrinsics. They just end up as single inlined bytecode instructions on the JVM.
f
Sorry I didn't see that
that was my assumption
thanks
k
But now I do want to know where that code is in the compiler 😄
f
do you know any examples in the stdlib that have operators functions with bodies?
k
Lists, BigInteger, BigDecimal, Arrays, String.
f
ok thanks
No, the String class also doesn't have a body
for plus
neither does List
BigDecimal doesnt have any operator funs at all
You're right, I can't find one for strings.
f
thanks
for some reason they are not like this when I open them in IntelliJ
k
They are for me, I just did
Ctrl+B
on the
+
in this code:
Copy code
val x = arrayOf(1,2,3) + arrayOf(4,5,6)
val y = listOf(1,2,3) + listOf(4,5,6)
f
yea that works
k
What didn't work then?
f
BigInteger doesnt have this function in my source code
k
Where does
Ctrl+B
on
Copy code
val z = BigInteger.ONE + BigInteger.ONE
get you?
f
Oops, I ended up in the Java package