Hacker News new | ask | show | jobs
by akkartik 3321 days ago
In a previous project I spent a lot of time thinking about significant indentation (http://akkartik.name/post/wart), so I'm glad to see it getting more mind-share. However, the end comments are absolutely insane. Here's a counter-proposal: if you want optional end delimiters, make them not look like comments. Then the relevant examples in OP would look like this:

  def f =
    def g =
      ...
      (long code sequence)
      ...
  end f  // optional

  while
    println("z")
    true
  do
    println("x")
    println("y")
  end while  // optional

  package p with
    object o with
      class C extends Object
                 with Serializable with
        val x = new C with
            def y = 3

        val result =
          if x == x then
            println("yes")
            true
          else
            println("no")
            false
      end C  // optional
    end o  // you guessed it: optional
Edit: somebody already brought this up in the comments on Github: https://github.com/lampepfl/dotty/issues/2491#issuecomment-3...