This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Control flow exceptions

1 reply
milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.

There's a growing number of exceptions in the compiler and standard
libraries which are used solely for control flow. Unfortunately there
isn't currently any straightforward way to distinguish them from
exceptions which actually indicate problems. This is causing me a few
minor headaches with reporting in the IDE, and more generally it's a
bit of a pain.

So I propose the addition of a scala.util.control.ControlException
trait and have all the relevant exceptions mix it in ... this would
allow code which cares to filter out control exceptions simply.

The exceptions affected would be,

scala.tools.nsc.ast.parser.MarkupParsers
ConfusedAboutBracesException
MissingEndTagException
MarkupParsers.TruncatedXML

scala.tools.nsc.interactive.CompilerControl
CancelActionReq
FreshRunReq
ShutdownReq

scala.tools.nsc.interactive.Global
TyperResult

scala.tools.nsc.typechecker.Infer
DeferredNoInstance
NoInstance

scala.actors
KillActorException,
QuitException
SuspendActorException

scala.runtime
NonLocalReturnException

scala.util.control
BreakException

Are there any that I've missed or which shouldn't be included on this list?

Thoughts?

Cheers,

Miles

Erik Engbrecht
Joined: 2008-12-19,
User offline. Last seen 3 years 18 weeks ago.
Re: Control flow exceptions
+1

On Wed, Jul 8, 2009 at 5:33 AM, Miles Sabin <miles@milessabin.com> wrote:
There's a growing number of exceptions in the compiler and standard
libraries which are used solely for control flow. Unfortunately there
isn't currently any straightforward way to distinguish them from
exceptions which actually indicate problems. This is causing me a few
minor headaches with reporting in the IDE, and more generally it's a
bit of a pain.

So I propose the addition of a scala.util.control.ControlException
trait and have all the relevant exceptions mix it in ... this would
allow code which cares to filter out control exceptions simply.

The exceptions affected would be,

 scala.tools.nsc.ast.parser.MarkupParsers
   ConfusedAboutBracesException
   MissingEndTagException
   MarkupParsers.TruncatedXML

 scala.tools.nsc.interactive.CompilerControl
   CancelActionReq
   FreshRunReq
   ShutdownReq

 scala.tools.nsc.interactive.Global
   TyperResult

 scala.tools.nsc.typechecker.Infer
   DeferredNoInstance
   NoInstance

 scala.actors
   KillActorException,
   QuitException
   SuspendActorException

 scala.runtime
   NonLocalReturnException

 scala.util.control
   BreakException

Are there any that I've missed or which shouldn't be included on this list?

Thoughts?

Cheers,


Miles

--
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin



--
http://erikengbrecht.blogspot.com/

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland