unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod'
       [not found] ` <20170502072024.97B9A20CAB@vcs0.savannah.gnu.org>
@ 2017-05-02 14:08   ` Stefan Monnier
  2017-05-03 21:46     ` Dmitry Gutov
  2017-05-10 14:24     ` Dmitry Gutov
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2017-05-02 14:08 UTC (permalink / raw)
  To: emacs-devel; +Cc: Gemini Lasswell

> -             [ &optional keywordp ]     ; this is key :before etc
> -             list                       ; arguments
> +             [ &optional keywordp       ; this is key :before etc
> +               &optional stringp ]      ; :extra can be followed by a string

Actually, there can be any number of non-lists between the function name
and the arg list.  So it should probably be more like [ &rest atom ] or
something like that.


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod'
  2017-05-02 14:08   ` [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod' Stefan Monnier
@ 2017-05-03 21:46     ` Dmitry Gutov
  2017-05-04 15:50       ` Stefan Monnier
  2017-05-10 14:24     ` Dmitry Gutov
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2017-05-03 21:46 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel; +Cc: Gemini Lasswell

Hi Stefan,

On 02.05.2017 17:08, Stefan Monnier wrote:
>> -             [ &optional keywordp ]     ; this is key :before etc
>> -             list                       ; arguments
>> +             [ &optional keywordp       ; this is key :before etc
>> +               &optional stringp ]      ; :extra can be followed by a string
> 
> Actually, there can be any number of non-lists between the function name
> and the arg list.  So it should probably be more like [ &rest atom ] or
> something like that.

Why not

-             [ &optional keywordp       ; this is key :before etc
-               &optional stringp ]      ; :extra can be followed by a 
string
+             [ &rest              ; multiple qualifiers are allowed
+               &or keywordp       ; this is key :before etc
+               stringp ]          ; :extra can be followed by a string

?

Do we anticipate any non-keyword, non-string qualifiers?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod'
  2017-05-03 21:46     ` Dmitry Gutov
@ 2017-05-04 15:50       ` Stefan Monnier
  2017-05-05  0:44         ` Dmitry Gutov
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2017-05-04 15:50 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Gemini Lasswell, emacs-devel

> Do we anticipate any non-keyword, non-string qualifiers?

The CLOS spec allows any non-list value and cl-generic.el implements the
same rule.  Whether some code somewhere will ever make use of that extra
flexibility, I don't know.  I can imagine numbers and non-keyword
symbols being used, and since cons cells aren't allowed, I could also
imagine vectors being handy for complex cases.  I'm hard pressed to
imagine use of anything beyond that, OTOH.


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod'
  2017-05-04 15:50       ` Stefan Monnier
@ 2017-05-05  0:44         ` Dmitry Gutov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Gutov @ 2017-05-05  0:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Gemini Lasswell, emacs-devel

On 04.05.2017 18:50, Stefan Monnier wrote:

> The CLOS spec allows any non-list value and cl-generic.el implements the
> same rule.  Whether some code somewhere will ever make use of that extra
> flexibility, I don't know.  I can imagine numbers and non-keyword
> symbols being used, and since cons cells aren't allowed, I could also
> imagine vectors being handy for complex cases.  I'm hard pressed to
> imagine use of anything beyond that, OTOH.

I see, thanks. Applied your original suggestion.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod'
  2017-05-02 14:08   ` [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod' Stefan Monnier
  2017-05-03 21:46     ` Dmitry Gutov
@ 2017-05-10 14:24     ` Dmitry Gutov
  2017-05-10 15:18       ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2017-05-10 14:24 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel; +Cc: Gemini Lasswell

On 02.05.2017 17:08, Stefan Monnier wrote:
>> -             [ &optional keywordp ]     ; this is key :before etc
>> -             list                       ; arguments
>> +             [ &optional keywordp       ; this is key :before etc
>> +               &optional stringp ]      ; :extra can be followed by a string
> 
> Actually, there can be any number of non-lists between the function name
> and the arg list.  So it should probably be more like [ &rest atom ] or
> something like that.

By the way, do we want to support methods with zero arguments here? nil 
is an atom, and not a list.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod'
  2017-05-10 14:24     ` Dmitry Gutov
@ 2017-05-10 15:18       ` Stefan Monnier
  2017-05-10 21:49         ` Dmitry Gutov
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2017-05-10 15:18 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Gemini Lasswell, emacs-devel

>>> -             [ &optional keywordp ]     ; this is key :before etc
>>> -             list                       ; arguments
>>> +             [ &optional keywordp       ; this is key :before etc
>>> +               &optional stringp ]      ; :extra can be followed by a string
>> 
>> Actually, there can be any number of non-lists between the function name
>> and the arg list.  So it should probably be more like [ &rest atom ] or
>> something like that.

> By the way, do we want to support methods with zero arguments here? nil is
> an atom, and not a list.

IIRC CLOS does not allow 0-arg methods (and it allows nil as a qualifier),
whereas cl-defmethod uses `listp` to distinguish args from qualifiers,
so it doesn't allow nil as qualifier (tho I suspect it doesn't handle
a 0-arg method "correctly" either).


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod'
  2017-05-10 15:18       ` Stefan Monnier
@ 2017-05-10 21:49         ` Dmitry Gutov
  2017-05-10 21:54           ` Dmitry Gutov
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2017-05-10 21:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Gemini Lasswell, emacs-devel

On 10.05.2017 18:18, Stefan Monnier wrote:

> IIRC CLOS does not allow 0-arg methods (and it allows nil as a qualifier),
> whereas cl-defmethod uses `listp` to distinguish args from qualifiers,
> so it doesn't allow nil as qualifier (tho I suspect it doesn't handle
> a 0-arg method "correctly" either).

Seems to handle it okay, these both work:

(cl-defgeneric foo ()
   (1+ 2))

(cl-defmethod foo ()
   (1+ 4))

The latter redefines the default method, but that's to be expected.

If we want to support that kind of cl-defmethod in edebug, apparently we 
shold replace [&rest atom] with [&rest [&not listp]].



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod'
  2017-05-10 21:49         ` Dmitry Gutov
@ 2017-05-10 21:54           ` Dmitry Gutov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Gutov @ 2017-05-10 21:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Gemini Lasswell, emacs-devel

On 11.05.2017 0:49, Dmitry Gutov wrote:

> If we want to support that kind of cl-defmethod in edebug, apparently we 
> shold replace [&rest atom] with [&rest [&not listp]].

Or maybe [&rest &not null atom].




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-10 21:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170502072023.14740.35996@vcs0.savannah.gnu.org>
     [not found] ` <20170502072024.97B9A20CAB@vcs0.savannah.gnu.org>
2017-05-02 14:08   ` [Emacs-diffs] master d895f6c: Fix Edebug specs for 'cl-defmethod' and 'defmethod' Stefan Monnier
2017-05-03 21:46     ` Dmitry Gutov
2017-05-04 15:50       ` Stefan Monnier
2017-05-05  0:44         ` Dmitry Gutov
2017-05-10 14:24     ` Dmitry Gutov
2017-05-10 15:18       ` Stefan Monnier
2017-05-10 21:49         ` Dmitry Gutov
2017-05-10 21:54           ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).