opendylan
opendylan copied to clipboard
No compiler warning for bad singleton dispatch
https://play.opendylan.org/shared/fad09bebf972f561
define function foo (n == 0)
list(n)
end;
format-out("%=\n", foo(0)); // good
format-out("%=\n", foo(1)); // bad, no warning
format-out("%=\n", foo("")); // good, warning
So it appears there's no compile-time warning if the type of the argument (<integer>) matches the type of the singleton parameter (object-class(0)). Same for symbols so I assume it's a general problem and just hasn't been implemented yet.
There is, of course, a runtime error.