Details

      Description

      The special procedure syntax has been a constant source of trouble and confusion for people learning Scala, while providing no benefit except a few saved characters over using the standard method syntax.

      To not cause pointless work for people, this migration has to happen in multiple steps:

      • Update the style guide and the specification
      • Update tools (IDEs, Scalariform, ...)
      • Deprecate procedure syntax

      Mailing list discussion: https://groups.google.com/d/topic/scala-internals/q1YX7NC1geM/discussion

      ScalaDays 2013 Keynote: http://www.parleys.com/play/51c1994ae4b0d38b54f4621b/chapter47

        Attachments

          Issue Links

            Activity

            Hide
            asloane Tony Sloane added a comment -

            Just for the record, I'd like to record one vote against removing the procedure syntax.

            I may be the only one but I use procedure syntax for situations where I do not intend to return anything, reserving the "normal" syntax for places where a value is returned. I personally find a benefit from having the two different syntaxes to indicate these two situations and I haven't experienced any issues or confusions from having both.

            Show
            asloane Tony Sloane added a comment - Just for the record, I'd like to record one vote against removing the procedure syntax. I may be the only one but I use procedure syntax for situations where I do not intend to return anything, reserving the "normal" syntax for places where a value is returned. I personally find a benefit from having the two different syntaxes to indicate these two situations and I haven't experienced any issues or confusions from having both.
            Hide
            ichoran Rex Kerr added a comment - - edited

            I also vote against removing this syntax.

            I find it visually useful (more useful than : Unit = especially when specifying/guaranteeing that there is no return type), it is well-established (and thus a change would affect many lines of code), and even if it is a source of confusion for newcomers it should be quickly dispelled.

            Show
            ichoran Rex Kerr added a comment - - edited I also vote against removing this syntax. I find it visually useful (more useful than : Unit = especially when specifying/guaranteeing that there is no return type), it is well-established (and thus a change would affect many lines of code), and even if it is a source of confusion for newcomers it should be quickly dispelled.
            Hide
            soc Simon Ochsenreither added a comment -

            As mentioned in the thread, nobody claims that experts who know both procedures and methods can't tell them apart.

            The issue is that pretty much everyone learning the language falls into the trap of defining a procedure by forgetting the = when they actually intended to define a method.

            I don't consider saving 5 characters enough of a reason to expose people learning the language to such a frustrating, unnecessary language detail.

            Just a nitpick: The only type which doesn't return anything is Nothing, not Unit (which returns ()). But = is required for Nothing. Yet another reason why I want to get rid of this inconsistency.)

            Show
            soc Simon Ochsenreither added a comment - As mentioned in the thread, nobody claims that experts who know both procedures and methods can't tell them apart. The issue is that pretty much everyone learning the language falls into the trap of defining a procedure by forgetting the = when they actually intended to define a method. I don't consider saving 5 characters enough of a reason to expose people learning the language to such a frustrating, unnecessary language detail. Just a nitpick: The only type which doesn't return anything is Nothing , not Unit (which returns () ). But = is required for Nothing . Yet another reason why I want to get rid of this inconsistency.)
            Hide
            asloane Tony Sloane added a comment -

            I'm certainly not claiming that some beginners don't find this a stumbling point. In my experience of teaching Scala to upper level undergraduates I haven't seen it to be a major problem, certainly not compared to other much trickier things that Scala asks them to learn.

            Show
            asloane Tony Sloane added a comment - I'm certainly not claiming that some beginners don't find this a stumbling point. In my experience of teaching Scala to upper level undergraduates I haven't seen it to be a major problem, certainly not compared to other much trickier things that Scala asks them to learn.
            Hide
            soc Simon Ochsenreither added a comment -

            PR for the compiler part is https://github.com/scala/scala/pull/3076.

            Show
            soc Simon Ochsenreither added a comment - PR for the compiler part is https://github.com/scala/scala/pull/3076 .
            Hide
            moors Adriaan Moors added a comment -

            Please open separate issues for separate work items. The compiler part is fixed.

            Show
            moors Adriaan Moors added a comment - Please open separate issues for separate work items. The compiler part is fixed.

              People

              • Assignee:
                soc Simon Ochsenreither
                Reporter:
                soc Simon Ochsenreither
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: