* should fset 'symbol get an undefined function warning?
@ 2007-10-30 5:14 Dan Nicolaescu
2007-10-30 18:58 ` Stefan Monnier
2007-10-31 0:09 ` Richard Stallman
0 siblings, 2 replies; 8+ messages in thread
From: Dan Nicolaescu @ 2007-10-30 5:14 UTC (permalink / raw)
To: emacs-devel
The warning "the function `my-fset-test' is not known to be defined"
is generated when compiling:
(fset 'my-fset-test 'foo)
(my-fset-test)
Wouldn't it be better if the warning was not generated?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should fset 'symbol get an undefined function warning?
2007-10-30 5:14 should fset 'symbol get an undefined function warning? Dan Nicolaescu
@ 2007-10-30 18:58 ` Stefan Monnier
2007-10-30 20:47 ` Dan Nicolaescu
2007-10-31 0:09 ` Richard Stallman
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2007-10-30 18:58 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: emacs-devel
> The warning "the function `my-fset-test' is not known to be defined"
> is generated when compiling:
> (fset 'my-fset-test 'foo)
> (my-fset-test)
> Wouldn't it be better if the warning was not generated?
Could be. But if you use `defalias' the warning will be gone. Why do
you want to use `fset'?
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should fset 'symbol get an undefined function warning?
2007-10-30 18:58 ` Stefan Monnier
@ 2007-10-30 20:47 ` Dan Nicolaescu
2007-10-30 21:05 ` Drew Adams
0 siblings, 1 reply; 8+ messages in thread
From: Dan Nicolaescu @ 2007-10-30 20:47 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> > The warning "the function `my-fset-test' is not known to be defined"
> > is generated when compiling:
>
> > (fset 'my-fset-test 'foo)
> > (my-fset-test)
>
> > Wouldn't it be better if the warning was not generated?
>
> Could be. But if you use `defalias' the warning will be gone. Why do
> you want to use `fset'?
"I" don't, but there are a some files in the tree that do that, one
that I remember of the top of my head is viper-util. But there are
some more.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: should fset 'symbol get an undefined function warning?
2007-10-30 20:47 ` Dan Nicolaescu
@ 2007-10-30 21:05 ` Drew Adams
2007-10-30 21:59 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2007-10-30 21:05 UTC (permalink / raw)
To: Dan Nicolaescu, Stefan Monnier; +Cc: emacs-devel
> > > The warning "the function `my-fset-test' is not known to be defined"
> > > is generated when compiling:
> > > (fset 'my-fset-test 'foo) (my-fset-test)
> > > Wouldn't it be better if the warning was not generated?
> >
> > Could be. But if you use `defalias' the warning will be gone. Why do
> > you want to use `fset'?
>
> "I" don't, but there are a some files in the tree that do that, one
> that I remember of the top of my head is viper-util. But there are
> some more.
AFAIK, `fset' is not deprecated or obsolete (and the Elisp manual is full of
`fset').
`defalias' might be better to use in this context, but it should still be
good to not issue that warning for `fset'. (I'm not saying anyone has
disagreed with that.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should fset 'symbol get an undefined function warning?
2007-10-30 21:05 ` Drew Adams
@ 2007-10-30 21:59 ` Stefan Monnier
2007-10-30 22:39 ` Drew Adams
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2007-10-30 21:59 UTC (permalink / raw)
To: Drew Adams; +Cc: Dan Nicolaescu, emacs-devel
> AFAIK, `fset' is not deprecated or obsolete (and the Elisp manual is full of
> `fset').
> `defalias' might be better to use in this context, but it should still be
> good to not issue that warning for `fset'. (I'm not saying anyone has
> disagreed with that.)
I disagree: `fset' is meant to *change* the function-slot
of a symbol, not to initialize it. So it's use shouldn't be treated by
the byte-compiler as a declaration. Insted, the byute-compiler should
complain about the use of `fset' on an unknown function similarly to the
use of `set(q)' on an unknown variable.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: should fset 'symbol get an undefined function warning?
2007-10-30 21:59 ` Stefan Monnier
@ 2007-10-30 22:39 ` Drew Adams
2007-10-31 0:55 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2007-10-30 22:39 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Dan Nicolaescu, emacs-devel
> > `defalias' might be better to use in this context, but it
> > should still be good to not issue that warning for `fset'.
> > (I'm not saying anyone has disagreed with that.)
>
> I disagree: `fset' is meant to *change* the function-slot
> of a symbol, not to initialize it. So it's use shouldn't be treated by
> the byte-compiler as a declaration. Insted, the byute-compiler should
> complain about the use of `fset' on an unknown function similarly to the
> use of `set(q)' on an unknown variable.
Good point. I'm convinced.
Was there an opposing consideration that led you to say "Could be" at first,
or was that before this point occurred to you?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should fset 'symbol get an undefined function warning?
2007-10-30 5:14 should fset 'symbol get an undefined function warning? Dan Nicolaescu
2007-10-30 18:58 ` Stefan Monnier
@ 2007-10-31 0:09 ` Richard Stallman
1 sibling, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2007-10-31 0:09 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: emacs-devel
The warning "the function `my-fset-test' is not known to be defined"
is generated when compiling:
(fset 'my-fset-test 'foo)
(my-fset-test)
If you use `fset' it means that you are playing around with the
symbol's definition. So it seems like a mistake to assume anything
about it. Normally the first arg of `fset' is not a quoted constant
anyway.
If you want to make an alias that the compiler will know about, use
`defalias'.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: should fset 'symbol get an undefined function warning?
2007-10-30 22:39 ` Drew Adams
@ 2007-10-31 0:55 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2007-10-31 0:55 UTC (permalink / raw)
To: Drew Adams; +Cc: Dan Nicolaescu, emacs-devel
>> > `defalias' might be better to use in this context, but it
>> > should still be good to not issue that warning for `fset'.
>> > (I'm not saying anyone has disagreed with that.)
>>
>> I disagree: `fset' is meant to *change* the function-slot
>> of a symbol, not to initialize it. So it's use shouldn't be treated by
>> the byte-compiler as a declaration. Insted, the byute-compiler should
>> complain about the use of `fset' on an unknown function similarly to the
>> use of `set(q)' on an unknown variable.
> Good point. I'm convinced.
> Was there an opposing consideration that led you to say "Could be" at first,
> or was that before this point occurred to you?
No. My area of expertise is functional programming where there's a *very*
clear difference between changing the value of a variable and initializing
that variable (e.g. in SML and Haskell you simply can't do the equivalent
of `setq' or `fset').
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-10-31 0:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-30 5:14 should fset 'symbol get an undefined function warning? Dan Nicolaescu
2007-10-30 18:58 ` Stefan Monnier
2007-10-30 20:47 ` Dan Nicolaescu
2007-10-30 21:05 ` Drew Adams
2007-10-30 21:59 ` Stefan Monnier
2007-10-30 22:39 ` Drew Adams
2007-10-31 0:55 ` Stefan Monnier
2007-10-31 0:09 ` Richard Stallman
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).