tuxji commented on code in PR #1176:
URL: https://github.com/apache/daffodil/pull/1176#discussion_r1519918017
##########
daffodil-io/src/main/scala/org/apache/daffodil/io/DirectOrBufferedDataOutputStream.scala:
##########
@@ -90,53 +92,53 @@ private[io] class ByteArrayOrFileOutputStream(
throw new FileIOException(
"Unable to create temporary file in %s: %s".format(
tempDirPath.getPath,
- e.getMessage(),
+ e.getMessage,
),
)
}
val newStream: java.io.OutputStream = new
java.io.FileOutputStream(maybeFile.get)
- stream.flush
+ stream.flush()
Review Comment:
The inclusion of empty parens in function definitions/calls is a semantic
signal to all programmers that the function is not a pure function, that is, it
performs a side effect or changes mutable state. If a Scala function is
declared/implemented with empty parens, the IDE will warn if calls are made
without empty parens. Likewise, if the function is defined as a parameterless
function (without empty parens), the IDE will warn if function calls are made
with empty parens. However, Java doesn't implement these semantics itself, so
Scala 2 is very liberal when it comes to mixing parameterless and empty-paren
methods and calls. You can add or remove empty parens in any place and the
code will compile/run anyway although other programmers may misunderstand the
function's semantics. I think the Scala 3 compiler has become stricter and
will check/enforce these semantics to a greater extent.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]