When one debugs and prints out f.name, console outs f too.
In the other hand, once you wrap a given named function using def, JavaScript runtimes won't automatically set the function name anymore and probably one will get an empty string in place of f.name.
This change is important since functions typed with def aren't anonymous anymore and they can be seen in a given stack trace after some throw. If typing isn't enough to locate where's the issue, at least one may be able to review the stack trace and follow the code with this extra detail.
Say you've defined a function as follows:
When one debugs and prints out
f.name
, console outsf
too.In the other hand, once you wrap a given named function using
def
, JavaScript runtimes won't automatically set the function name anymore and probably one will get an empty string in place off.name
.This change is important since functions typed with
def
aren't anonymous anymore and they can be seen in a given stack trace after somethrow
. If typing isn't enough to locate where's the issue, at least one may be able to review the stack trace and follow the code with this extra detail.