Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.lisp > #33002

Re: symbol-macros -vs- symbol setf-expander

From "Pascal J. Bourguignon" <pjb@informatimago.com>
Newsgroups comp.lang.lisp
Subject Re: symbol-macros -vs- symbol setf-expander
Date 2019-05-31 21:24 +0200
Organization Informatimago
Message-ID <m2muj21l7h.fsf@despina.home> (permalink)
References (2 earlier) <20190522125932.721@kylheku.com> <jwv1s0fd9ej.fsf-monnier+comp.lang.lisp@gnu.org> <20190530214258.24@kylheku.com> <m2r28e1yg8.fsf@despina.home> <20190531112949.658@kylheku.com>

Show all headers | View raw


Kaz Kylheku <847-115-0292@kylheku.com> writes:

> On 2019-05-31, Pascal J. Bourguignon <pjb@informatimago.com> wrote:
>> Kaz Kylheku <847-115-0292@kylheku.com> writes:
>>>
>>> The define-setf-expander call in placelet1 is useless and can be
>>> removed. …
>>>
>>> Lucky for as, …
>>>
>>> The approach will fail …
>>
>> Why would you consider an approach that will fail???
>
> It might fail to expand due to a form having no setf expansion being
> used as a place. The placelet1 macro could be easily refined to detect
> the situation, and provide an accurate diagnostic.
>
> Why I would consider the approach is that it's very simple and
> doesn't rely on any non-portable features.
>
> At least it's worth noting/documenting: "if we are able to take a
> certain requirement off the table, such and such highly simplified trick
> is possible which handles the remaining requirements".

Furthermore, even if one call to get-setf-expansion gives you a result
such as (cdr #:foo), it doesn't mean that another call (notably with a
different &environment, but possibly for any reason (eg. different
optimization level, different run-time (OS where the same executable
runs), etc could have given a different expression for the getter, one
one hand, and on the other hand, there's also no guaranteed that the
expression given by the getter be actually a place.  Eg. you could get a
(kdr #:foo) instead, with no (setf kdr).

So basically, you need to perform the test, visually, which is worse
than automatically, but you can also do it automatically, but it all
comes down to perusing the section 5.1.2.2.
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_5-1-2-2.html
Ie. you must make the decision when you write the code.

-- 
__Pascal J. Bourguignon__
http://www.informatimago.com

Back to comp.lang.lisp | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

symbol-macros -vs- symbol setf-expander Stefan Monnier <monnier@iro.umontreal.ca> - 2019-05-21 15:46 -0400
  Re: symbol-macros -vs- symbol setf-expander Kaz Kylheku <847-115-0292@kylheku.com> - 2019-05-21 21:25 +0000
    Re: symbol-macros -vs- symbol setf-expander Kaz Kylheku <847-115-0292@kylheku.com> - 2019-05-22 20:07 +0000
      Re: symbol-macros -vs- symbol setf-expander Stefan Monnier <monnier@iro.umontreal.ca> - 2019-05-30 15:40 -0400
        Re: symbol-macros -vs- symbol setf-expander Kaz Kylheku <847-115-0292@kylheku.com> - 2019-05-31 04:51 +0000
          Re: symbol-macros -vs- symbol setf-expander "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-05-31 16:38 +0200
            Re: symbol-macros -vs- symbol setf-expander Kaz Kylheku <847-115-0292@kylheku.com> - 2019-05-31 18:42 +0000
              Re: symbol-macros -vs- symbol setf-expander "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-05-31 21:24 +0200
                Re: symbol-macros -vs- symbol setf-expander Kaz Kylheku <847-115-0292@kylheku.com> - 2019-06-01 02:34 +0000
              Re: symbol-macros -vs- symbol setf-expander Stefan Monnier <monnier@iro.umontreal.ca> - 2019-05-31 18:14 -0400
                Re: symbol-macros -vs- symbol setf-expander Kaz Kylheku <847-115-0292@kylheku.com> - 2019-06-01 02:51 +0000
                Re: symbol-macros -vs- symbol setf-expander Stefan Monnier <monnier@iro.umontreal.ca> - 2019-06-02 12:16 -0400
                Re: symbol-macros -vs- symbol setf-expander Kaz Kylheku <847-115-0292@kylheku.com> - 2019-06-03 01:13 +0000
        Re: symbol-macros -vs- symbol setf-expander Stefan Monnier <monnier@iro.umontreal.ca> - 2019-05-31 18:04 -0400
  Re: symbol-macros -vs- symbol setf-expander "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-05-22 22:00 +0200
    Re: symbol-macros -vs- symbol setf-expander a.daniel.eliason@gmail.com - 2019-05-23 08:10 -0700
      Re: symbol-macros -vs- symbol setf-expander Spiros Bousbouras <spibou@gmail.com> - 2019-05-23 15:22 +0000
        Re: symbol-macros -vs- symbol setf-expander Dimitri Fontaine <dim@tapoueh.org> - 2019-05-23 18:02 +0200
          Re: symbol-macros -vs- symbol setf-expander Spiros Bousbouras <spibou@gmail.com> - 2019-05-23 16:51 +0000
        Re: symbol-macros -vs- symbol setf-expander Kaz Kylheku <847-115-0292@kylheku.com> - 2019-05-23 17:05 +0000
          Re: symbol-macros -vs- symbol setf-expander "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-05-23 19:26 +0200
  Re: symbol-macros -vs- symbol setf-expander smh <shaflich@gmail.com> - 2019-05-22 18:47 -0700

csiph-web