Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-1673

code quality: use non-deprecated syntax for methods that don't return a value

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: deferred
    • Component/s: clean ups, Infrastructure
    • Labels:
      None

      Description

      This syntax is officially deprecated.

      def someFun(x: String) { .... } 

      Instead one must write explicitly:

      def someFun(x:String): Unit = { ... }

      Meaning that the value of x.length is discarded and the function returns Unit (or () if you prefer) instead.

      I'd like to stress out that this is deprecated since Oct 29, 2013 (https://github.com/scala/scala/pull/3076/), but the warning only shows up if you compile with the -Xfuture flag.

      We should turn on the -Xfuture flag, and fix this and any other deprecations that come up.

      We may want to write a sed-script or other automation. I have generally preferred the now-deprecated style in my code, so there are many many cases.

      scala -Xfuture -deprecation
       
      scala> def foo {}
      <console>:1: warning: Procedure syntax is deprecated. Convert procedure `foo` to method by adding `: Unit =`.
             def foo {}
      foo: Unit

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              mbeckerle.dfdl Mike Beckerle
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Tasks