Discussion:
[Q] introspecting setf expanders
Didier Verna
2012-10-08 13:28:17 UTC
Permalink
Content preview: Hello, I cannot find a standard way to figure out whether
a setf expander has been defined for a symbol FOO (via either DEFSETF or
DEFINE-SETF-EXPANDER). Is there one? Otherwise, I would also be happy with
an SBCL-only solution. [...]

Content analysis details: (-102.1 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-100 USER_IN_WHITELIST From: address is in the user's white-list
0.0 FSL_HELO_NON_FQDN_1 FSL_HELO_NON_FQDN_1
-2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/722>


Hello,

I cannot find a standard way to figure out whether a setf expander has
been defined for a symbol FOO (via either DEFSETF or
DEFINE-SETF-EXPANDER).

Is there one? Otherwise, I would also be happy with an SBCL-only
solution.


Thank you !
--
Resistance is futile. You will be jazzimilated.

Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
Raymond Wiker
2012-10-08 13:51:01 UTC
Permalink
Content preview: On Oct 8, 2012, at 15:28 , Didier Verna wrote: > Hello, >
I cannot find a standard way to figure out whether a setf expander has >
been defined for a symbol FOO (via either DEFSETF or > DEFINE-SETF-EXPANDER).
Is there one? Otherwise, I would also be happy with an SBCL-only > solution.
Thank you ! [...]
Content analysis details: (-0.7 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low
trust
[209.85.217.179 listed in list.dnswl.org]
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
(rwiker[at]gmail.com)
-0.0 SPF_PASS SPF: sender matches SPF record
0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/723>
Hello,
I cannot find a standard way to figure out whether a setf expander has
been defined for a symbol FOO (via either DEFSETF or
DEFINE-SETF-EXPANDER).
Is there one? Otherwise, I would also be happy with an SBCL-only
solution.
Thank you !
#'get-setf-expansion, perhaps?
Didier Verna
2012-10-08 14:56:58 UTC
Permalink
Content preview: Raymond Wiker <rwiker-***@public.gmane.org> wrote: > #'get-setf-expansion,
perhaps? Nope, because it gives you something by default. [...]

Content analysis details: (-102.1 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-100 USER_IN_WHITELIST From: address is in the user's white-list
0.0 FSL_HELO_NON_FQDN_1 FSL_HELO_NON_FQDN_1
-2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/724>
Post by Raymond Wiker
#'get-setf-expansion, perhaps?
Nope, because it gives you something by default.

CL-USER> (get-setf-expansion '(not-previously-defined))
NIL
NIL
(#:NEW886)
(FUNCALL #'(SETF NOT-PREVIOUSLY-DEFINED) #:NEW886)
(NOT-PREVIOUSLY-DEFINED)
--
Resistance is futile. You will be jazzimilated.

Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
Didier Verna
2012-10-08 15:38:42 UTC
Permalink
Content preview: Pascal Costanza wrote: > Just guessing: If you see that the
writer form is a funcall to a setf > function, you can then check with fboundp
if such a function actually > exists. This is probably a bit shaky, but maybe
good enough for > practical purposes? [...]

Content analysis details: (-102.1 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-100 USER_IN_WHITELIST From: address is in the user's white-list
0.0 FSL_HELO_NON_FQDN_1 FSL_HELO_NON_FQDN_1
-2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/725>
Just guessing: If you see that the writer form is a funcall to a setf
function, you can then check with fboundp if such a function actually
exists. This is probably a bit shaky, but maybe good enough for
practical purposes?
Good idea. To be more precise:

- if the writer form is something else than (FUNCALL #'(SETF FOO) ...)
then there is a defsetf going on (it even takes precedence over a
potential setf function).

- if the writer form is (FUNCALL #'(SETF FOO) ...) and that function is
bound, then there is a setf function going on but no defsetf.

- otherwise, there is no writer at all.


I think this might just work.
--
Resistance is futile. You will be jazzimilated.

Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
Martin Simmons
2012-10-09 11:29:27 UTC
Permalink
Pascal Costanza wrote: > > > Just guessing: If you see that the writer
form is a funcall to a setf > > function, you can then check with fboundp
if such a function actually > > exists. This is probably a bit shaky, but
- if the writer form is something else than (FUNCALL #'(SETF FOO) ...)
then there is a defsetf going on (it even takes precedence over a > potential
setf function). > > - if the writer form is (FUNCALL #'(SETF FOO) ...) and
that function is > bound, then there is a setf function going on but no defsetf.
- otherwise, there is no writer at all. > > > I think this might just
work. [...]

Content analysis details: (-2.1 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/727>
Just guessing: If you see that the writer form is a funcall to a setf
function, you can then check with fboundp if such a function actually
exists. This is probably a bit shaky, but maybe good enough for
practical purposes?
- if the writer form is something else than (FUNCALL #'(SETF FOO) ...)
then there is a defsetf going on (it even takes precedence over a
potential setf function).
- if the writer form is (FUNCALL #'(SETF FOO) ...) and that function is
bound, then there is a setf function going on but no defsetf.
- otherwise, there is no writer at all.
I think this might just work.
As Pascal said, it's a bit shaky. E.g. a user could define

(defsetf foo (x) (y)
`(funcall #'(setf foo) ,y ,x))

which gives a false negative.

Also, it won't be portable, because the (FUNCALL #'(SETF FOO) ...) form isn't
required (the standard just specifies something with the same effect as it).
--
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/
Pascal Costanza
2012-10-08 15:20:04 UTC
Permalink
Content preview: Just guessing: If you see that the writer form is a funcall
to a setf function, you can then check with fboundp if such a function actually
exists. This is probably a bit shaky, but maybe good enough for practical
purposes? [...]

Content analysis details: (-102.3 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium
trust
[217.70.178.89 listed in list.dnswl.org]
-100 USER_IN_WHITELIST From: address is in the user's white-list
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/726>

Just guessing: If you see that the writer form is a funcall to a setf function, you can then check with fboundp if such a function actually exists. This is probably a bit shaky, but maybe good enough for practical purposes?

Pascal
Post by Didier Verna
Post by Raymond Wiker
#'get-setf-expansion, perhaps?
Nope, because it gives you something by default.
CL-USER> (get-setf-expansion '(not-previously-defined))
NIL
NIL
(#:NEW886)
(FUNCALL #'(SETF NOT-PREVIOUSLY-DEFINED) #:NEW886)
(NOT-PREVIOUSLY-DEFINED)
--
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
_______________________________________________
pro mailing list
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro
--
Pascal Costanza
Pascal J. Bourguignon
2012-10-09 11:52:07 UTC
Permalink
Content preview: IMO, you will have to see what's done by each implementation,
and use implementation specific, perhaps even internal functions to get that
information. This would be a good subject for a CDR, to provide a public
introspective API. [...]

Content analysis details: (-2.1 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/728>

IMO, you will have to see what's done by each implementation, and use implementation specific, perhaps even internal functions to get that information.

This would be a good subject for a CDR, to provide a public introspective API.
--
__Pascal Bourguignon__
Post by Didier Verna
Hello,
I cannot find a standard way to figure out whether a setf expander has
been defined for a symbol FOO (via either DEFSETF or
DEFINE-SETF-EXPANDER).
Is there one? Otherwise, I would also be happy with an SBCL-only
solution.
Thank you !
--
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
_______________________________________________
pro mailing list
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro
Marco Antoniotti
2012-10-09 14:16:46 UTC
Permalink
Content preview: On Oct 9, 2012, at 07:52 , Pascal J. Bourguignon wrote: >
IMO, you will have to see what's done by each implementation, and use implementation
specific, perhaps even internal functions to get that information. > > This
would be a good subject for a CDR, to provide a public introspective API.
[...]

Content analysis details: (-2.1 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-0.0 SPF_PASS SPF: sender matches SPF record
-2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/729>
Post by Pascal J. Bourguignon
IMO, you will have to see what's done by each implementation, and use implementation specific, perhaps even internal functions to get that information.
This would be a good subject for a CDR, to provide a public introspective API.
I second that. A "side" CDR would be to specify other "function specifiers" beside (SETF FOO).

Cheers
--
MA
Post by Pascal J. Bourguignon
--
__Pascal Bourguignon__
Post by Didier Verna
Hello,
I cannot find a standard way to figure out whether a setf expander has
been defined for a symbol FOO (via either DEFSETF or
DEFINE-SETF-EXPANDER).
Is there one? Otherwise, I would also be happy with an SBCL-only
solution.
Thank you !
--
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
_______________________________________________
pro mailing list
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro
_______________________________________________
pro mailing list
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro
--
Marco Antoniotti, Associate Professor tel. +39 - 02 64 48 79 01
DISCo, Università Milano Bicocca U14 2043 http://bimib.disco.unimib.it
Viale Sarca 336
I-20126 Milan (MI) ITALY

Please note that I am not checking my Spam-box anymore.
Please do not forward this email without asking me first.

Loading...