close Warning: Can't synchronize with repository "(default)" ("(default)" is not readable or not a Git repository.). Look in the Trac log for more information.

Opened 10 years ago

Closed 10 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:


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:

  1. The warning is confusing because there's neither an ECASE nor an CCASE involved.
  1. T is a perfectly good type specifier and the compiler will warn about unreachable code anyway.
  1. Arguably it's stylistically better to use ETYPECASE instead of TYPECASE whenever possible, but this warning pretty much encourages TYPECASE.
  1. 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 10 years ago by Raymond Toy

  1. That should be fixed.
  2. Yes, T is a perfectly fine type specifier, but I don't see any warning in your example about unreachable code.
  3. I don't understand why you would use ETYPECASE with T since that basically means there's no error produced since everything is a subtype of T.
  4. Right, there's nothing wrong with T, but then you might as well use CASE instead. I guess this warning is to warn about silly mistakes where you accidentally included T but were still expecting an error to be produced.

comment:2 Changed 10 years ago by toy.raymond@…

Resolution: fixed
Status: newclosed

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.