unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
@ 2012-06-18 17:45 Drew Adams
  2012-06-18 20:37 ` Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2012-06-18 17:45 UTC (permalink / raw)
  To: 11735

I load a library that I did not write, which does this:
 
(require 'cl)
(defun foo 
    (short full 
     short-index initial-full-index 
     chunks current-chunk current-chunk-pos 
     recurse-p)
  "..."
  (declare ;(optimize speed)
   (fixnum short-index initial-full-index)
   (simple-string short full)
   (special *all-chunks*))
 
Now I see this in *Messages*"
 
Warning: Unknown defun property fixnum in foo
Warning: Unknown defun property simple-string in foo
 
Is this a bug?
 
In GNU Emacs 24.1.50.1 (i386-mingw-nt5.1.2600)
 of 2012-06-18 on MARVIN
Bzr revision: 108646 michael.albinus@gmx.de-20120617185439-jfcgwwbr97nbflkz
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --no-opt --enable-checking --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'
 






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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-18 17:45 bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..." Drew Adams
@ 2012-06-18 20:37 ` Stefan Monnier
  2012-06-18 20:49   ` Drew Adams
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2012-06-18 20:37 UTC (permalink / raw)
  To: Drew Adams; +Cc: 11735

> I load a library that I did not write, which does this:
> (require 'cl)
> (defun foo 
>     (short full 
>      short-index initial-full-index 
>      chunks current-chunk current-chunk-pos 
>      recurse-p)
>   "..."
>   (declare ;(optimize speed)
>    (fixnum short-index initial-full-index)
>    (simple-string short full)
>    (special *all-chunks*))
 
> Now I see this in *Messages*"
 
> Warning: Unknown defun property fixnum in foo
> Warning: Unknown defun property simple-string in foo
 
> Is this a bug?
 
It's a name-clash between Elisp's `declare' and CL's `declare', which
results in warnings, which AFAIK are harmless.


        Stefan





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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-18 20:37 ` Stefan Monnier
@ 2012-06-18 20:49   ` Drew Adams
  2012-06-18 21:11     ` Drew Adams
  0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2012-06-18 20:49 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 11735

> > Warning: Unknown defun property fixnum in foo
> > Warning: Unknown defun property simple-string in foo
>  
> > Is this a bug?
>  
> It's a name-clash between Elisp's `declare' and CL's `declare', which
> results in warnings, which AFAIK are harmless.

Yes, well it would be clearer for us to say something about _declare_ here, not
just something about a "defun property".

Bonus points for saying something to make it clear to users (of cl.el) that
these particular Common Lisp `declare' settings are not supported by cl.el.

(Warnings are not necessarily harmless, BTW, mais passons...)

Anyway, feel free to close the bug.  I mainly wanted to raise the question, not
being sure this was the message you intended.






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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-18 20:49   ` Drew Adams
@ 2012-06-18 21:11     ` Drew Adams
  2012-06-18 21:43       ` Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2012-06-18 21:11 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 11735

> > > Warning: Unknown defun property fixnum in foo
> > > Warning: Unknown defun property simple-string in foo
> >  
> > > Is this a bug?
> >  
> > It's a name-clash between Elisp's `declare' and CL's 
> > `declare', which results in warnings, which AFAIK are harmless.
> 
> Yes, well it would be clearer for us to say something about 
> _declare_ here, not just something about a "defun property".
> 
> Bonus points for saying something to make it clear to users 
> (of cl.el) that these particular Common Lisp `declare' settings are not 
> supported by cl.el.
> 
> (Warnings are not necessarily harmless, BTW, mais passons...)
> 
> Anyway, feel free to close the bug.  I mainly wanted to raise 
> the question, not being sure this was the message you intended.

Actually, no; I'm being too lenient about this.

This should _not_ be a runtime message that _users_ see, IMO.  Byte-compiler
"warnings" are one thing (they can be annoying enough occasionally).  This,
however, is downright obnoxious.

I'm seeing this each time I start Emacs, just because I load a library
(`el-swank-fuzzy') that someone converted from SLIME code.

If Emacs doesn't know how to handle such things then it should wisely apply the
maxim, "Better to keep your mouth shut and be thought a fool than to open it and
remove all doubt."  IOW, do not advertise Emacs ignorance at runtime, just pass
over it in respectful silence.

Byte compilation is a different story.  Yes, we should let someone who is
byte-compiling know about such things.  But not users who just load (and maybe
never invoke anything in) some library.

Can we please put a muzzle on this?  Thx.






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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-18 21:11     ` Drew Adams
@ 2012-06-18 21:43       ` Stefan Monnier
  2012-06-18 22:03         ` Drew Adams
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2012-06-18 21:43 UTC (permalink / raw)
  To: Drew Adams; +Cc: 11735

> I'm seeing this each time I start Emacs, just because I load a library
> (`el-swank-fuzzy') that someone converted from SLIME code.

Then, byte-compile it, and the message will go away.


        Stefan





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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-18 21:43       ` Stefan Monnier
@ 2012-06-18 22:03         ` Drew Adams
  2012-06-19  0:59           ` Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2012-06-18 22:03 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 11735

> Then, byte-compile it, and the message will go away.

Great, but that doesn't sound like a general solution for the problem.

It's not about my use of this library.  Or even about an arbitrary user's use of
this library.

Apparently you are wedded to the idea of a runtime message here.  Haven't seen
any reason given, but whatever.

To me this is a poster child for the kind of thing we should not be issuing a
runtime warning for: a Common-Lisp declaration that we do not even recognize
(hence can have no effect), and which in Common Lisp itself is only for
optimization anyway.

But it's your call, of course.  I ask only that you think about it.






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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-18 22:03         ` Drew Adams
@ 2012-06-19  0:59           ` Stefan Monnier
  2012-06-19  2:45             ` Drew Adams
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2012-06-19  0:59 UTC (permalink / raw)
  To: Drew Adams; +Cc: 11735

> Apparently you are wedded to the idea of a runtime message here.

No, it's simply a macro-expansion-time message.  Macro-expansion either
happens at compile-time, or if the file is not compiled it happens at
run-time.  The macro doesn't know whether it's called during compilation
or at run-time.


        Stefan





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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-19  0:59           ` Stefan Monnier
@ 2012-06-19  2:45             ` Drew Adams
  2012-06-19 11:54               ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2012-06-19  2:45 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 11735

> > Apparently you are wedded to the idea of a runtime message here.
> 
> No, 

So if you are not wedded to it, then perhaps this will be fixed?

> it's simply a macro-expansion-time message.  
> Macro-expansion either
> happens at compile-time, or if the file is not compiled it happens at
> run-time.  The macro doesn't know whether it's called during 
> compilation or at run-time.

Thanks for the implementation description.  But that does not speak to what the
message is really for and whether or how much the current implementation really
fits the message's purpose.

Do what you will with this bug report.  To my mind it is misguided to bother &
possibly confuse users with this kind of message when they just load some
library.

Without checking the Common Lisp spec (IANAL), I would guess that even Common
Lisp, which defines such optimization declarations, leaves it up to CL
implementations to ignore some of them.  But I doubt that it leaves it up to
them to raise a warning for those declarations it does not recognize.

Just a guess (haven't read CLTL in a _long_ time).  But that's typically the
approach taken for this kind of thing (optimization declarations, hints to
compilers or optimizers, etc.): Handle the unknown with silence - not with
alarm.






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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-19  2:45             ` Drew Adams
@ 2012-06-19 11:54               ` Juanma Barranquero
  2012-06-19 13:34                 ` Drew Adams
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2012-06-19 11:54 UTC (permalink / raw)
  To: Drew Adams; +Cc: 11735

On Tue, Jun 19, 2012 at 4:45 AM, Drew Adams <drew.adams@oracle.com> wrote:

> Without checking the Common Lisp spec (IANAL), I would guess that even Common
> Lisp, which defines such optimization declarations, leaves it up to CL
> implementations to ignore some of them.  But I doubt that it leaves it up to
> them to raise a warning for those declarations it does not recognize.

This is SBCL 1.0.55.7.mswinmt.1185-d20ec0c, an implementation of ANSI
Common Lisp.
;; [etc]
* (defun test1 () (declare (foo)) t)
; in: defun test1
;     (FOO)
;
; caught warning:
;   unrecognized declaration (foo)
;
; compilation unit finished
;   caught 1 WARNING condition

test1
* (defun test2 () (declare (optimize bar)) t)
; in: defun test2
;     (OPTIMIZE BAR)
;
; caught warning:
;   Ignoring unknown optimization quality bar in: (optimize bar)
;
; compilation unit finished
;   caught 1 WARNING condition

test2
*





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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-19 11:54               ` Juanma Barranquero
@ 2012-06-19 13:34                 ` Drew Adams
  2012-06-19 13:41                   ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2012-06-19 13:34 UTC (permalink / raw)
  To: 'Juanma Barranquero'; +Cc: 11735

> > Without checking the Common Lisp spec (IANAL), I would 
> > guess that even Common Lisp, which defines such optimization
> > declarations, leaves it up to CL implementations to ignore
> > some of them.  But I doubt that it leaves it up to
> > them to raise a warning for those declarations it does not 
> > recognize.
> 
> This is SBCL 1.0.55.7.mswinmt.1185-d20ec0c, an implementation of ANSI
> Common Lisp.
> * (defun test2 () (declare (optimize bar)) t)
> ; in: defun test2
> ;     (OPTIMIZE BAR)
> ; caught warning:
> ;   Ignoring unknown optimization quality bar in: (optimize bar)
> ; compilation unit finished
> ;   caught 1 WARNING condition

OK, so you've confirmed my doubt.  I stand corrected.

(Actually, you've shown only that there exists an implementation (albeit a
common one) that prints a warning.  That does not confirm that the CL spec says
that's OK.  But I claimed IANAL...)

Perhaps this kind of message is a candidate for a :debug warning level?  I
already said that it is useful for programmers.  I do not see it as helpful for
general users just loading a library.  On the contrary: some might become
confused, if not downright worried.  That's all I'm trying to say.






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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-19 13:34                 ` Drew Adams
@ 2012-06-19 13:41                   ` Juanma Barranquero
  2012-06-19 16:36                     ` Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2012-06-19 13:41 UTC (permalink / raw)
  To: Drew Adams; +Cc: 11735

On Tue, Jun 19, 2012 at 3:34 PM, Drew Adams <drew.adams@oracle.com> wrote:

> (Actually, you've shown only that there exists an implementation (albeit a
> common one) that prints a warning.  That does not confirm that the CL spec says
> that's OK.  But I claimed IANAL...)

http://www.sbcl.org/manual/index.html#ANSI-Conformance

"Essentially every type of non-conformance is considered a bug. (The
exceptions involve internal inconsistencies in the standard.)"

> Perhaps this kind of message is a candidate for a :debug warning level?  I
> already said that it is useful for programmers.  I do not see it as helpful for
> general users just loading a library.  On the contrary: some might become
> confused, if not downright worried.  That's all I'm trying to say.

I'm all for ways to silence irrelevant warnings.

    Juanma





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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-19 13:41                   ` Juanma Barranquero
@ 2012-06-19 16:36                     ` Stefan Monnier
  2012-06-19 17:08                       ` Drew Adams
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2012-06-19 16:36 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 11735

>> (Actually, you've shown only that there exists an implementation
>> (albeit a common one) that prints a warning.  That does not confirm
>> that the CL spec says that's OK.  But I claimed IANAL...)
> http://www.sbcl.org/manual/index.html#ANSI-Conformance

AFAIK, contrary to Ada, Common Lisp does not try to enforce particular
behaviors with respect to compilation warnings.

>> Perhaps this kind of message is a candidate for a :debug warning level?  I
>> already said that it is useful for programmers.  I do not see it as helpful for
>> general users just loading a library.  On the contrary: some might become
>> confused, if not downright worried.  That's all I'm trying to say.

Just to put things in perspective, this message only occurs for uses of
`declare' which use declarations not supported directly by Elisp
(that's fairly uncommon) and only for those `declare's that are inside
a `defun' rather than a `defun*' (even less common), and then only for
code that's not byte-compiled.
That's sufficiently rare that I'm not worried about it.


        Stefan





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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-19 16:36                     ` Stefan Monnier
@ 2012-06-19 17:08                       ` Drew Adams
  2012-06-19 21:37                         ` Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2012-06-19 17:08 UTC (permalink / raw)
  To: 'Stefan Monnier', 'Juanma Barranquero'; +Cc: 11735

> Common Lisp does not try to enforce particular
> behaviors with respect to compilation warnings.

OK.

> >> Perhaps this kind of message is a candidate for a :debug 
> >> warning level?  I already said that it is useful for
> >> programmers.  I do not see it as helpful for general users
> >> just loading a library.  On the contrary: some might become
> >> confused, if not downright worried.  That's all I'm trying to say.
> 
> Just to put things in perspective, this message only occurs 
> for uses of `declare' which use declarations not supported
> directly by Elisp (that's fairly uncommon)

Maybe not so uncommon for code that either is designed to work also with other
Emacsen (XEmacs? dunno) or for code that was originally taken from some other
Lisp.

The latter seems to be the case for `el-swank-fuzzy.el'.

> and only for those `declare's that are inside a `defun' rather
> than a `defun*' (even less common),

Less common: doubtful in the latter case I mentioned.  `el-swank-fuzzy.el' is an
example here too.  It uses both `defun*' and `defun', and it uses the
unsupported `declare' settings only with `defun'.

The point is not that that library is a model or does things the way they should
be done.  The point is that that library is perhaps not atypical or rare as an
example of code that was moved to Emacs Lisp from Common Lisp.

The author presumably used `defun' when that was straightforward, and used
`defun*' when s?he needed Common Lisp `defun' thingies that are not available in
Emacs `defun'.  (Doing that instead of just using `defun*' everywhere has the
advantage of making it clear which function definitions really need the added
juice of `defun*'.)

> and then only for code that's not byte-compiled.
> That's sufficiently rare that I'm not worried about it.

Maybe not worrying.  But worth a bug report.  And it would be good to give this
message a :debug warning level so it does not annoy or confuse users.  Any
reason not to do that?  At least as a wishlist item?






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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-19 17:08                       ` Drew Adams
@ 2012-06-19 21:37                         ` Stefan Monnier
  2012-06-19 22:01                           ` Drew Adams
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2012-06-19 21:37 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Juanma Barranquero', 11735

> Maybe not worrying.  But worth a bug report.  And it would be good to
> give this message a :debug warning level so it does not annoy or
> confuse users.  Any reason not to do that?

How 'bout because we don't have any notion of "level" of messages?
Remember: this is a `message' from a macro, not some warning from the
byte-compiler.


        Stefan





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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-19 21:37                         ` Stefan Monnier
@ 2012-06-19 22:01                           ` Drew Adams
  2014-02-09  3:40                             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2012-06-19 22:01 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 'Juanma Barranquero', 11735

> because we don't have any notion of "level" of messages?
> Remember: this is a `message' from a macro, not some warning from the
> byte-compiler.

OK.

So any expansion of the macro will lead to the message.  Guess I have to give up
hoping that the message could be targeted better to the programmer writing the
(declare...), whom it is aimed at, and not also users of the library.

The text could still perhaps be improved, as I suggested.  It would be better to
(a) mention `declare' and (b) show the unsupported expression in its entirety.






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

* bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..."
  2012-06-19 22:01                           ` Drew Adams
@ 2014-02-09  3:40                             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 16+ messages in thread
From: Lars Ingebrigtsen @ 2014-02-09  3:40 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Juanma Barranquero', 11735

"Drew Adams" <drew.adams@oracle.com> writes:

>> because we don't have any notion of "level" of messages?
>> Remember: this is a `message' from a macro, not some warning from the
>> byte-compiler.
>
> OK.
>
> So any expansion of the macro will lead to the message.  Guess I have to give up
> hoping that the message could be targeted better to the programmer writing the
> (declare...), whom it is aimed at, and not also users of the library.

Ok; closing.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

end of thread, other threads:[~2014-02-09  3:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-18 17:45 bug#11735: 24.1.50; "Warning: Unknown defun property ... in ..." Drew Adams
2012-06-18 20:37 ` Stefan Monnier
2012-06-18 20:49   ` Drew Adams
2012-06-18 21:11     ` Drew Adams
2012-06-18 21:43       ` Stefan Monnier
2012-06-18 22:03         ` Drew Adams
2012-06-19  0:59           ` Stefan Monnier
2012-06-19  2:45             ` Drew Adams
2012-06-19 11:54               ` Juanma Barranquero
2012-06-19 13:34                 ` Drew Adams
2012-06-19 13:41                   ` Juanma Barranquero
2012-06-19 16:36                     ` Stefan Monnier
2012-06-19 17:08                       ` Drew Adams
2012-06-19 21:37                         ` Stefan Monnier
2012-06-19 22:01                           ` Drew Adams
2014-02-09  3:40                             ` Lars Ingebrigtsen

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).