lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating alists


From: David Kastrup
Subject: Re: Updating alists
Date: Fri, 31 Dec 2021 00:31:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Lukas-Fabian Moser <lfm@gmx.de> writes:

> Hi Jean,
>
>>
>> Both of these cases seem to work the same as in
>> current versions if I do
>>
>> [...]
>>
>>  SCM
>>  assq_tail (SCM key, SCM alist, SCM based_on = SCM_EOL)
>>  {
>> -  for (SCM p = alist; !scm_is_eq (p, based_on); p = scm_cdr (p))
>> +  for (SCM p = alist; scm_is_pair (p) && scm_is_pair (scm_car (p))
>> && !scm_is_eq (p, based_on); p = scm_cdr (p))
>>      {
>>        if (scm_is_eq (scm_caar (p), key))
>>          return p;
>
> Thanks! This seems to be a sensible precaution anyway, as it only
> changes a certain crash into returning #f. So it might be sensible to
> make this change anyway?

Uh what?  assq_tail is exclusively used on internal data structures.
There is no "certain crash" without internal data structures being
corrupted and it seems counterproductive to expend additional
performance in order to hide that internal data structures have been
corrupted.

> I'm a bit surprised about the remark in the code stating that the
> choice not to coalesce multiple override's was made to save the cost
> of detecting them, as it does not seem to be a code path used heavily
> at all.

Overrides of subproperties are used pretty extensively in some newer
code.

Maybe it would make sense to check where code is being used before
trying to change it?

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]