bool IsApproxEqual(float a, float b, float epsilon = Mathf.Epsilon) // Default parameter value for 'epsilon' must be a compile-time constant
unity. why. why is your epsilon value a readonly static.
@ilobmirt hehehe! 💜 in c#, default parameters need to be a statically analyzable constant value; i assume this is probably to help ease static analysis and parsing efforts of the compiler when it comes to type checking and dealing with potential side effects from code
in javascript and python, you can do really cursed amazing things with default parameters
function sideEffect(value) {
console.log(value)
}
function someFunc(value, optionalValue = sideEffect(value)) {}
someFunc(1) // console prints '1'
@rowan @ilobmirt in Python this is even more cursed because sideEffect(value)
only gets evaluated once which is a Terrible Fucking Behavior and lets you do shit like this:
def internal_append(value, list_ = []):
list_.append(value)
return list_
internal_append(1) # -> [1]
internal_append(2) # -> [1, 2]
internal_append(3) # -> [1, 2, 3]
I actually think that JS’s behavior is really nice though