[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] pkl: Add exception_new to register user-defined exceptions
From: |
Mohammad-Reza Nabipoor |
Subject: |
Re: [PATCH] pkl: Add exception_new to register user-defined exceptions |
Date: |
Mon, 25 Jan 2021 14:27:03 +0330 |
Hi, Jose.
On Mon, Jan 25, 2021 at 11:14:04AM +0100, Jose E. Marchesi wrote:
>
> Hi Mohammad.
>
> > Hi, Jose!
> >
> > This commit introduces a new function `exception_new` to give an
> > `Exception` value with a unique `code` number.
> > (Based on your suggestion a while ago in IRC).
>
> I like the approach.
>
> However, this couples the contents of exceptions with the
> `exception_new' generator.
>
> What is really generated is the exception code, so what about having an
> `exception_code' generator. User-defined exceptions would then be
> defined like:
>
> var E_my_exception = Exception { code = exception_new, ... };
>
> WDYT?
>
I considered both approaches and chose the approach that I thought
is more user-friendly.
User just wants to define a new exception and don't need to be concerned
about the `code` field.
But OK, I'll send the new patch soon.
Regards,
Mohammad-Reza