https://kotlinlang.org logo
#announcements
Title
# announcements
k

kirillrakhman

05/24/2017, 11:59 AM
It would be nice to have syntax highlighting for the kotlin blocks
otherwise the comments (in spanish) add too much noise and the actual code is hard to make out
s

serandel

05/24/2017, 12:06 PM
we've found no kotlin syntax highlighter for wordpress
but you're absolutely right about comments
and function names
i've asked the translator to change them
thx
k

kirillrakhman

05/24/2017, 12:18 PM
maybe you can copy the preformatted code from IDEA and paste it in Wordpress as is.
@serandel have you tried https://de.wordpress.org/plugins/wp-code-highlightjs/? I used standalone highlight.js before and it works with Kotlin
m

mg6maciej

05/24/2017, 12:52 PM
Yeah, the comments add to much noise. Hard to spot code that will not result in what comments say, like this:
Copy code
val peras: Int = 1
val manzanas: Int = 1
  
println(peras.equals(manzanas)) // True
println(peras == manzanas)        // True
println(peras === manzanas)      // El == de Java, False en este caso
All 3 cases will return
true
...
Even if you change them to nullable:
Copy code
val peras: Int? = 1
val manzanas: Int? = 1
Would have to assign large enough value to have them `false`:
Copy code
val peras: Int? = 128
val manzanas: Int? = 128
(same in Java)
s

serandel

05/24/2017, 12:59 PM
@mg6maciej does the compiler reuse the same instance?
m

mg6maciej

05/24/2017, 1:01 PM
It's cached at runtime.
Check out
java.lang.Integer.valueOf
source.
s

serandel

05/24/2017, 1:03 PM
you're my hero
🙃 1
published a revised version
thanks for your help! 🙂
m

mg6maciej

05/24/2017, 2:46 PM
Copy code
val apples: Int = 128
val oranges: Int = 128
will still return
true
.
It's much better if you have all the code in an article in a project and with tests. 🙂
Same with code in slides.
s

serandel

05/25/2017, 10:13 AM
it was a rookie mistake
you're 100% right
2 Views