[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] Methods and functions
From: |
Jose E. Marchesi |
Subject: |
Re: [RFC] Methods and functions |
Date: |
Mon, 04 May 2020 09:23:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hi Ege!
I do have one tiny consideration, that you did not ask for, if I
may. I understand that the support for methods is very similar to that
of functions, so much that defun can be extended for the sake of
simplicity. Simplicity for a poke developer... However, after reading
your detailed email, I am convinced that methods and functions are
indeed different entities for a Poke writer (mind the capital
letter). Not all of them will be lucky enough to read this email of
yours before stumbling upon behavioral differences between the
"functions" they define. It seems to me that it would be quite easy to
adjust the parser to accept defmeth, or something as such, in a
struct, rather than defun. Then, defmeth could be defined as a single
defun to use your current implementation. That would be only to
enforce the awareness of the differences between functions and methods
on the folks who are writing them. Have you considered using a
different keyword for methods? If you are against that, can you share
your reasoning so that I can learn from it?
Hmm, allowing to optionally use defmethod instead of defun is an
interesting idea.
However, if we do that, we could very well _force_ to use defmethod when
defining methods, and to not allow to use defun in that context, for the
time being.
That way, we keep forward compatibility in case in the future we want to
support functions in struct types, with the restrictions we already
talked about...