Sorry to keep replying to myself...

On Tue, Jan 28, 2020 at 15:13 Trey Harris <t...@lopsa.org> wrote:

> All core class Exception objects, as a matter of convention, start with
> `X::`.
>

...to which a natural question arises: what about non-core Exception
objects?

Raku lets you call Exceptions whatever you want, so putting convention
aside, anything is possible.

But one case that is typical for non-core modules is for, e.g.,
`My::Library` to define a `class My::Library::Exception is Exception {...}`
as an “abstract class”, and then define the library’s exceptions as `class
X::MySpecialException is My::Library::Exception`. This allows the author to
refer to their own exceptions as a group using `My::Library::Exception`,
and to still use shorter `X::` names for things that they throw.

It isn’t necessary to do this, and some libraries derive all the exceptions
directly from `Exception`. (And some do `My::Library::X::...` or other
idiosyncratic naming schemes.) But they _tend_ to still start with the
`X::` name for convention.

Trey

>

Reply via email to