Opened 11 years ago
Closed 11 years ago
#98 closed defect (fixed)
Annoying warning for ETYPECASE
Reported by: | Helmut Eller | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Core | Version: | 2014-05 |
Keywords: | Cc: |
Description
In code like this:
(defun foo (x) (etypecase x (number 1) (t 2)))
CMUCL produces this
Warning: Bad style to use T or OTHERWISE in ECASE or CCASE
This is annoying for several reasons:
- The warning is confusing because there's neither an ECASE nor an CCASE involved.
- T is a perfectly good type specifier and the compiler will warn about unreachable code anyway.
- Arguably it's stylistically better to use ETYPECASE instead of TYPECASE whenever possible, but this warning pretty much encourages TYPECASE.
- Even for ECASE and CCASE I don't see anything wrong with using T as key.
In summary, I suggest to remove the warning for ETYPECASE altogether and if you really want to keep it for ECASE then at least make it a STYLE-WARNING instead of a WARNING.
Change History (2)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
commit c0a0fc0b9d458cae139b873dc496764d8e8e0113 Author: Raymond Toy <toy.raymond@…> Date: Sun Jun 1 07:58:59 2014 -0700
Fix ticket:98
Change the warning to a style-warning and update the message to be more precious.
Note: See
TracTickets for help on using
tickets.
T
is a perfectly fine type specifier, but I don't see any warning in your example about unreachable code.ETYPECASE
withT
since that basically means there's no error produced since everything is a subtype ofT
.T
, but then you might as well useCASE
instead. I guess this warning is to warn about silly mistakes where you accidentally includedT
but were still expecting an error to be produced.