read the compared distances through the casts

A cast as the object of `.' keeps its parentheses now (sex#61), so
the comparator takes the two distances straight from its arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 18:10:24 +03:00
parent b74c445b25
commit d40455d824

View File

@@ -47,11 +47,9 @@
(record region-order ((rx int) (rz int) (distance double)))
(fn by-distance ((pa (* const void)) (pb (* const void))) int
;; TODO sex#61: cast inside the field access once a cast as the object
;; of . keeps its parentheses.
(var a (* const region-order) pa)
(var b (* const region-order) pb)
(return (- (> (. a distance) (. b distance)) (< (. a distance) (. b distance)))))
(var a _ (. (cast pa (* const region-order)) distance))
(var b _ (. (cast pb (* const region-order)) distance))
(return (- (> a b) (< a b))))
;;; A thread's generators, and the searched mineral's ore map of the
;;; region it last scanned in.