Hacker News new | past | comments | ask | show | jobs | submit login

> About \, yes it's the possible clash with a real quote.

Clash with a real quote? As in you paste random text from wherever and it turns out evaluated? You've got the exact same issue in Kotlin.

> About ranges, Ruby has both .. and ... and after 12 years I don't remember which is what. Maybe an inclusive one is enough and 1..(n-1)

That's why I like that Swift uses "a..<b" for exclusive, you clearly see the top-bound being excluded from the range. It's readable and smart design.

> Maybe an inclusive one is enough and 1..(n-1)

I have never missed inclusive ranges in languages with only exclusive ranges (e.g. Python), the opposite would not be true.

> About syntax in general, it should be easy for developers no matter how hard it is for the compiler/interpreter to parse it

That way lie Perl and C++ and undecidable syntaxes, I'm very much opposed to that.

> I don't like to have to type useless characters.

I don't see what's useless about saying what you're asking for. You define a struct your use a struct block, you define a protocol you use a a protocol block, you define an extension you use an extension block. It's readable and regular.

> But I don't understand your "has to be repeated for every addition" so maybe I'm missing something important here.

If you're adding more than one item in Kotlin you have to repeat the receiver e.g.

    val Double.km = (thing)
    val Double.miles = (thing)
    val Doubleā€¦
in Swift you just wrap it all in an extension block:

    extension Double {
        val km = (thing)
        val miles = (thing)
        val ...
    }



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: