Open krivachy opened 6 years ago
Similar here:
def overZero = (x: Int) => (x > 0)
def
means that every time overZero
is called it will create for you a function of (x: Int) => (x > 0)
. Arguable you don't need to always create the function so val
would be more appropriate here.
def is a method, it always evaluates while val is evaluated once. In com/danieljharvey/eggserver/MySQL.scala:22 you are doing (removed all extra code):
Everytime there's a
connection
called it creates a new one, soconnection.close
is not closing the previous one, but a new one and the previous one is never closed.