bug-mit-scheme
[Top][All Lists]
Advanced

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

[bug #63454] let-values expansion is suboptimal


From: Taylor R. Campbell
Subject: [bug #63454] let-values expansion is suboptimal
Date: Thu, 1 Dec 2022 08:11:56 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?63454>

                 Summary: let-values expansion is suboptimal
                 Project: MIT/GNU Scheme
               Submitter: riastradh
               Submitted: Thu 01 Dec 2022 01:11:54 PM UTC
                Category: runtime
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Suboptimal behavior
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                Keywords: 


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 01 Dec 2022 01:11:54 PM UTC By: Taylor R. Campbell <riastradh>
(pp (syntax '(let-values (((x) 5) ((y) 3))
               (list x y))
            (nearest-repl/environment)))
(let ((temp-0 (lambda () 5)) (temp-1 (lambda () 3)))
  (call-with-values
   temp-0
   (lambda (x)
     (call-with-values temp-1 (lambda (y) (list x y))))))

This has a high cost at runtime because the compiler knows nothing about
multiple-value returns, so it makes let-values unfit for use in
general-purpose macro expansion like foof-loop without a substantial
performance penalty.

Expected result:

(pp (syntax '(let-values (((x) 5) ((y) 3))
               (list x y))
            (nearest-repl/environment)))
(let ((y 3) (x 5))
  (list x y))

I wrote a let-values in syntax-rules years ago that generates call-with-values
only when necessary, attached.  (However, it doesn't work in MIT Scheme right
now because of bug #63438.)






    _______________________________________________________
File Attachments:


-------------------------------------------------------
Date: Thu 01 Dec 2022 01:11:54 PM UTC  Name: let-values.scm  Size: 5KiB   By:
riastradh

<http://savannah.gnu.org/bugs/download.php?file_id=54045>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63454>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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