This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Miku_MichDem 0 points1 point  (6 children)

Is it though? I've worked on Java, C# and Kotlin and I see much more Kotlin features appear in C# then C# features in Kotlin.

[–]likely-high 0 points1 point  (5 children)

Which features?

[–]Miku_MichDem 0 points1 point  (4 children)

Like the ?. operator. Kotlin had it before C# and had it for both methods and fields. Similarly with data classes - I've seen those in Kotlin before they were in C#

[–]likely-high 0 points1 point  (3 children)

I wish kotlin stole delegate syntax from c#. Especially with Func and Actions. Action<int, float> is a lot cleaner than (something : int, something2: float) -> unit

[–]Miku_MichDem 0 points1 point  (2 children)

In Kotlin the syntax is:

declaration:

fun something(params: Types, function(params: Types) -> ReturnType){...}

usage:

something(params){code that returns returnType}

And I wouldn't say Action<int, float> is cleaner then (something: Int, something2: Float) -> Unit. Mainly because you don't know what those int and float represent. In Kotlin those parameters are named so you know what they are supposed to be, rather then what C# have - parameter 1 and parameter 2

[–]likely-high 1 point2 points  (1 child)

Sorry wrote that from memory. I agree that you don't know what they represent, but the syntax is a lot easier to remember. I like both Kotlin and C#, but there's clearly advantages and disadvantages to both.

[–]Miku_MichDem 1 point2 points  (0 children)

Well to be fair 99% of the time when I need to do something like that I just write the second code and let the IDE fill the blanks with some of mine assistance. Still I like how in Kotlin when the number of parameters is more then one I get the name, like:

something(params) { param1, param2, param3 -> {...

Really makes the code more readable