Hi,

For more context, please checkout:

    https://issues.guix.gnu.org/issue/34999

On Tue, 24 Aug 2021 at 17:47, Leo Prikler <[email protected]> wrote:
> Am Dienstag, den 26.03.2019, 10:38 +0100 schrieb Ludovic Courtès:

>> The changes I made in version-control.scm and gnucash.scm in commit
>> e6301fb76d0a8d931ece2e18d197e3c2cc53fc6c revealed an abstraction
>> leakage
>> I wasn’t aware of: there’s a pattern where users “see” that thunked
>> fields are thunked:
>> 
>>   (package
>>     ;; …
>>     (inputs …)
>>     (arguments `(foo bar ,(inputs) …)))  ;<- here ‘inputs’ is seen as
>> a thunk

[...]

>             #`(make-struct/no-tail type
>                            #,@(map (lambda (field index)
> -                                    (or (field-inherited-value field)
> +                                    (or (and=>
> +                                         (field-inherited-value field)
> +                                         (lambda (value)
> +                                           (wrap-field-value field value)))
>                                          (if (innate-field? field)
>                                              (wrap-field-value
>                                               field (field-default-value 
> field))

For instance, this change is now irrelevant because of:

    9b01a64e53b1f61ee13b62ac54cbefaf144e7d51
and c14b8636fbac9826115f4524d500536d54c15625

The current equivalent part reads:

           (constructor-call
            (map (lambda (field index)
                   (or (field-inherited-value field)
                       (if (innate-field? field)
                           (wrap-field-value
                            field (field-default-value field))
                           #`(struct-ref #,orig-record #,index))))
                 '(expected ...)
                 (iota (length '(expected ...))))))

and the ’and=>’ part could be still applied here, right?


About the two other parts of the patch, namely:

> @@ -211,8 +214,7 @@ of TYPE matches the expansion-time ABI."
>             (map (lambda (field+value)
>                    (syntax-case field+value ()
>                      ((field value)
> -                     #`(field
> -                        #,(wrap-field-value #'field #'value)))))
> +                     #`(field value))))
>                  field+value))
>  
>           (syntax-case s (inherit expected ...)
> @@ -224,10 +226,11 @@ of TYPE matches the expansion-time ABI."
>             ((_ (field value) (... ...))
>              (let ((fields (map syntax->datum #'(field (... ...)))))
>                (define (field-value f)
> -                (or (find (lambda (x)
> -                            (eq? f (syntax->datum x)))
> -                          #'(field (... ...)))
> -                    (wrap-field-value f (field-default-value f))))
> +                (wrap-field-value f
> +                                  (or (find (lambda (x)
> +                                              (eq? f (syntax->datum x)))
> +                                            #'(field (... ...)))
> +                                      (field-default-value f))))
>  
>                ;; Pass S to make sure source location info is preserved.
>                (report-duplicate-field-specifier 'name s)

…I’ve not checked.

Well, the question is:  What do we do with this patch?  The bug is here
since so many years that now it might be considered as a feature. ;-)

WDYT?

Cheers,
simon



Reply via email to