mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Issue #489 - Guarantee order of eval begin exprs
Guarantee that sub-expressions of a begin are evaluated in order. The code was reversing the results of a map. However map is not necessarily guaranteed to evaluate its arguments in any given order because it could be optimized into another function such as `Cyc-map-loop-1`. Instead we just use the optimized function directly as a more general `map` is not required here and this function is guaranteed to process its argument list in a predicable order.
This commit is contained in:
parent
1506f0985f
commit
f8555f796d
2 changed files with 7 additions and 8 deletions
|
@ -9,6 +9,10 @@ Features
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
|
|
||||||
|
- Prevent an error when evaluating a `begin` expression that contains both a macro definition and an application of that macro. For example:
|
||||||
|
|
||||||
|
begin (define-syntax foo (syntax-rules () ((foo) 123))) (foo))
|
||||||
|
|
||||||
- Fix a regression where `c-compiler-options` was not recognized as a top level form by programs.
|
- Fix a regression where `c-compiler-options` was not recognized as a top level form by programs.
|
||||||
- Enforce a maximum recursion depth when printing an object via `display` and `write`, and when comparing objects via `equal?`. This prevents segmentation faults when working with circular data structures.
|
- Enforce a maximum recursion depth when printing an object via `display` and `write`, and when comparing objects via `equal?`. This prevents segmentation faults when working with circular data structures.
|
||||||
|
|
||||||
|
|
|
@ -636,14 +636,9 @@
|
||||||
;(display "/* ")
|
;(display "/* ")
|
||||||
;(write (list exp))
|
;(write (list exp))
|
||||||
;(display "*/ ")
|
;(display "*/ ")
|
||||||
(let ((fncs
|
(let ((fncs (Cyc-map-loop-1 (lambda (expr)
|
||||||
;; Our map starts from the end, we reverse
|
(analyze expr a-env rename-env local-renamed))
|
||||||
;; so everything is evaluated in order, then
|
(cdr exp))))
|
||||||
;; reverse again so results are in order
|
|
||||||
(reverse
|
|
||||||
(map (lambda (expr)
|
|
||||||
(analyze expr a-env rename-env local-renamed))
|
|
||||||
(reverse (cdr exp))))))
|
|
||||||
(lambda (env)
|
(lambda (env)
|
||||||
(foldl (lambda (fnc _) (fnc env)) #f fncs))))
|
(foldl (lambda (fnc _) (fnc env)) #f fncs))))
|
||||||
;; compiled macro
|
;; compiled macro
|
||||||
|
|
Loading…
Add table
Reference in a new issue