Timeline for Unexpected behaviors in built-in functions
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 9, 2021 at 15:12 | comment | added | Michael E2 |
FileExistsQ[""] has been fixed (<= V12.3.1). Maybe DirectoryQ , too. Can anyone confirm? -- Almost every *Q[] fails to return True or False if they have the wrong number of arguments, so one might want to exclude the "argx" messages as well as the "usage" ones. (They're loaded only after you make a mistake.)
|
|
Jun 16, 2020 at 9:23 | history | edited | CommunityBot |
Commonmark migration
|
|
Oct 30, 2018 at 8:31 | history | edited | Kuba | CC BY-SA 4.0 |
added 169 characters in body
|
Oct 30, 2018 at 8:30 | comment | added | Kuba | @MichaelE2 interesting exceptions :) | |
Oct 30, 2018 at 2:12 | comment | added | Michael E2 |
EllipticNomeQ never returns True or False .
|
|
Nov 29, 2017 at 20:45 | history | edited | Jason B. | CC BY-SA 3.0 |
added 16 characters in body
|
Nov 15, 2017 at 1:31 | comment | added | J. M.'s missing motivation♦ |
Another thing I forgot to mention: recall that If[] has a four argument form, where the first three arguments are the usual ones and the fourth one is the statement to evaluate if the predicate does not return True or False . This is one more possibility for the exception handling indicated by Kuba in the answer above.
|
|
Nov 14, 2017 at 19:53 | comment | added | Leonid Shifrin |
To me, this clearly looks like a consequence of the absence of exception-handling practices in idiomatic Mathematica (meaning, as recommended by the docs). The Q - predicates should return True or False , but when the input is invalid, it would make much more sense to throw an exception (which would be a much clearer semantics),than to remain unevaluated (which expressly breaks the Q contract) and issue a message. But for that, it should be possible to document that functions can throw exceptions, and that would require a better-integrated into the language exception-handling mechanism.
|
|
Nov 14, 2017 at 10:21 | history | edited | J. M.'s missing motivation♦ | CC BY-SA 3.0 |
added 105 characters in body
|
Nov 14, 2017 at 10:19 | history | edited | Kuba | CC BY-SA 3.0 |
added 370 characters in body
|
Nov 14, 2017 at 10:15 | comment | added | J. M.'s missing motivation♦ |
A corollary of this is that for safety, one might want to use TrueQ[] along with these predicate functions, e.g. TrueQ[FileExistsQ[filename]] .
|
|
Nov 14, 2017 at 10:14 | history | edited | Kuba | CC BY-SA 3.0 |
added 58 characters in body
|
S Nov 14, 2017 at 10:09 | history | answered | Kuba | CC BY-SA 3.0 | |
S Nov 14, 2017 at 10:09 | history | made wiki | Post Made Community Wiki by Kuba |