Re: Funcall setf forms
>> But is not the declaration of the setf method a kind of reference ?
>>
>>
>> (defmethod (setf my-method) (nwval (object type)) (do-something))
>
> Does your code ever use that method (directly!)? If not, why shouldn't
> it be deleted during treeshaking?
>
>>
>>> Your code might not reference it, since you compute the name.
>>
>> I precise that I do not compute the name dynamically : The methods are
>> declared normally. The name is just variable because it follows the
>> context
>> of the application at different moments (accessing one place or
>> another with
>> some existing methods).
>
> Declaration is one thing. But do you use it somewhere? The function
> name is
> computed: (list 'setf my-name) . So that's not a direct reference of
> the function.
Ah yes, I understand... You're right : some of these methods are never
called directly.
>
> I guess you need to tell the Lisp system not to remove the definition
> of these
> functions and/or the function names.
>
> See:
>
>
http://www.lispworks.com/documentation/lw51/DV/html/deluser-71.htm#pgfId-85217>
6
Yes I did. But in my deliver context, the :keep-function-name default-value
should be T, witch mean "Keep names as strings and retain argument
information.". It's why I thought that my function name must be present in
the image anyway. But I didn't thing to this special case : funcalled
functions are not referenced as others (I suppose it's also why we don't
find it when call the "Function Calls" utility of the IDE).
Thanks for your help !
Denis
>
> Regards,
>
> Rainer Joswig
>
>
>>
>>
>>> #'(setf foo) might still be there since it is referenced in a list by
>>> a global variable.
>>
>> Well, in my case it's a lot of works...
>>>
>>> Regards,
>>>
>>> Rainer Joswig
>>
>>
>> Best
>>
>> Denis
>>>>
>>>> Le 13/06/08 11:53, « [NOM] » <[ADRESSE]> a écrit :
>>>>
>>>>> On Fri, 13 Jun 2008 11:29:18 +0200, Denis Pousseur
>>>>> <denis.pousseur@gmail.com
>>>>>>
>>>>> wrote:
>>>>>
>>>>>> To make some setf forms funcallable, I use
>>>>>>
>>>>>> (defun mySetter (accessor object nwval)
>>>>>> (funcall (fdefinition (list 'setf accessor)) nwval object))
>>>>>>
>>>>>> It works, but after delivering at level 4 (with :compact t) I
>>>>>> encountered
>>>>>> this error :
>>>>>>
>>>>>> Undefined function SETF::\"MYPACKAGE\"\ \"MYFUNCTION\" in form
>>>>>> (SYMBOL-FUNCTION SETF::\" MYPACKAGE\"\ \" MYFUNCTION\")
>>>>>>
>>>>>> However, MYPACKAGE and MYFUNCTION are correct and works well when
>>>>>> not
>>>>>> delivered.
>>>>>>
>>>>>> What I need is simply the possibility to use setf dynamically on
>>>>>> accessors.
>>>>>> Is it a better method to do this ?
>>>>>
>>>>> This won't work for you?
>>>>>
>>>>> CL-USER 1 > (defun my-first (list)
>>>>> (first list))
>>>>> MY-FIRST
>>>>>
>>>>> CL-USER 2 > (defun (setf my-first) (new-value list)
>>>>> (setf (first list) new-value))
>>>>> (SETF MY-FIRST)
>>>>>
>>>>> CL-USER 3 > (defparameter *list* (list 1 2 3))
>>>>> *LIST*
>>>>>
>>>>> CL-USER 4 > (setf (my-first *list*) 42)
>>>>> 42
>>>>>
>>>>> CL-USER 5 > *list*
>>>>> (42 2 3)
>>>>>
>>>>> CL-USER 6 > (funcall #'(setf my-first) 43 *list*)
>>>>> 43
>>>>>
>>>>> CL-USER 7 > *list*
>>>>> (43 2 3)
>>>>
>>>> -------------------------------------------------------
>>>> Denis Pousseur
>>>> 70 rue de Wansijn
>>>> 1180 Bruxelles, Belgique
>>>>
>>>> Tel : 32 (0)2 219 31 09
>>>> Mail : denis.pousseur@gmail.com
>>>> -------------------------------------------------------
>>>>
>>>
>>> Rainer Joswig, Hamburg, Germany
>>> http://lispm.dyndns.org/
>>> mailto:joswig@lisp.de
>>>
>>>
>>>
>>
>> -------------------------------------------------------
>> Denis Pousseur
>> 70 rue de Wansijn
>> 1180 Bruxelles, Belgique
>>
>> Tel : 32 (0)2 219 31 09
>> Mail : denis.pousseur@gmail.com
>> -------------------------------------------------------
>>
>
> Rainer Joswig, Hamburg, Germany
> http://lispm.dyndns.org/
> mailto:joswig@lisp.de
>
>
>
-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique
Tel : 32 (0)2 219 31 09
Mail : denis.pousseur@gmail.com
-------------------------------------------------------