GNU bug report logs -
#25294
26.0.50; Allow more catch-all values for cl-defmethod's &context plus major-mode specializer
Previous Next
Reported by: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Date: Thu, 29 Dec 2016 19:14:02 UTC
Severity: wishlist
Tags: moreinfo
Found in version 26.0.50
Done: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Bug is archived. No further changes may be made.
Full log
Message #36 received at 25294 <at> debbugs.gnu.org (full text, mbox):
close 25294
quit
On 12/12/17 18:58 PM, Noam Postavsky wrote:
> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>
>> +Generic functions provide a new argument-list keyword,
>
> The way you phrased this might lead me to think that the &context
> keyword should go in the cl-defgeneric form (maybe it's not so bad when
> seeing in context under cl-defmethod, in patch form it's a bit
> disconnected).
>
>> +@code{&context}, which can be used to introduce extra specializers
>> +that test the general environment in which the method is run. This
>> +keyword should appear after the list of required arguments, but before
>> +any @code{&rest} or @code{&optional} keywords.
>
> I wonder if it would be clearer to add this to the @defmac header?
>
> @defmac cl-defmethod name [qualifier] arguments [&context (expr spec)@dots{}] &rest [docstring] body
>
> Hmm, maybe that ends up being too long.
>
>> The @code{&context}
>> +specializers look much like regular argument
>> +specializers---(@var{expr} @var{spec})---except that @var{expr} is an
>> +expression to be evaluated in the current context, and the @var{spec}
>> +is a value to compare against. For example, @code{&context
>> +(overwrite-mode (eql t))} will make the method applicable only when
>> +@code{overwrite-mode} is turned on. The @code{&context} keyword can
>> +be followed by any number of context specializers. Because the
>> +context specializers are not part of the generic function's required
>> +argument signature, they may be omitted in methods that don't require
>> +them.
>
> Otherwise looks fine.
>
Okay, that's pushed, I ended up adding the bit to the defmac statement
after all, it wraps and shouldn't be too big a deal.
Thanks,
Eric
This bug report was last modified 7 years and 210 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.