misc notes
This commit is contained in:
parent
10f096b923
commit
550f2749a1
|
@ -172,7 +172,7 @@
|
||||||
static-interface-members))
|
static-interface-members))
|
||||||
|
|
||||||
(begin-for-syntax
|
(begin-for-syntax
|
||||||
;; XXX fill this in
|
;; XXX fill this in for parents, etc
|
||||||
(define-generics layout))
|
(define-generics layout))
|
||||||
|
|
||||||
(define-syntax phase0:layout
|
(define-syntax phase0:layout
|
||||||
|
@ -186,6 +186,7 @@
|
||||||
#:literals (remix:#%brackets)
|
#:literals (remix:#%brackets)
|
||||||
[(def (remix:#%brackets me:id name:id)
|
[(def (remix:#%brackets me:id name:id)
|
||||||
f:id ...)
|
f:id ...)
|
||||||
|
;; xxx check for duplicates in f
|
||||||
(with-syntax* ([name-alloc (format-id #f "~a-alloc" #'name)]
|
(with-syntax* ([name-alloc (format-id #f "~a-alloc" #'name)]
|
||||||
[name-set (format-id #f "~a-set" #'name)]
|
[name-set (format-id #f "~a-set" #'name)]
|
||||||
[(f-idx ...)
|
[(f-idx ...)
|
||||||
|
@ -199,6 +200,7 @@
|
||||||
(begin
|
(begin
|
||||||
(begin-for-syntax
|
(begin-for-syntax
|
||||||
(define f->idx*acc
|
(define f->idx*acc
|
||||||
|
;; xxx base on parent's
|
||||||
(make-immutable-hasheq
|
(make-immutable-hasheq
|
||||||
(list (cons 'f (cons f-idx #'name-f))
|
(list (cons 'f (cons f-idx #'name-f))
|
||||||
...)))
|
...)))
|
||||||
|
@ -235,9 +237,11 @@
|
||||||
(λ ()
|
(λ ()
|
||||||
(raise-syntax-error
|
(raise-syntax-error
|
||||||
'name-alloc
|
'name-alloc
|
||||||
"missing initializer for ~a"
|
(format "missing initializer for ~a"
|
||||||
this-f))))])
|
this-f)
|
||||||
|
stx))))])
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
|
;; xxx push this in representation planner
|
||||||
(vector-immutable f-val (... ...))))]))
|
(vector-immutable f-val (... ...))))]))
|
||||||
(define-syntax (name-set stx)
|
(define-syntax (name-set stx)
|
||||||
(syntax-parse stx
|
(syntax-parse stx
|
||||||
|
@ -253,8 +257,10 @@
|
||||||
(#,this-name-f base-id)))))])
|
(#,this-name-f base-id)))))])
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
(let ([base-id base])
|
(let ([base-id base])
|
||||||
|
;; xxx push this in representation planner
|
||||||
(vector-immutable f-val (... ...)))))]))
|
(vector-immutable f-val (... ...)))))]))
|
||||||
(begin-encourage-inline
|
(begin-encourage-inline
|
||||||
|
;; xxx push this in representation planner
|
||||||
(define (name-f v) (unsafe-vector*-ref v f-idx))
|
(define (name-f v) (unsafe-vector*-ref v f-idx))
|
||||||
...)
|
...)
|
||||||
(define-syntax name
|
(define-syntax name
|
||||||
|
@ -262,6 +268,7 @@
|
||||||
(remix:#%brackets #:alloc name-alloc)
|
(remix:#%brackets #:alloc name-alloc)
|
||||||
(remix:#%brackets #:set name-set)
|
(remix:#%brackets #:set name-set)
|
||||||
(remix:#%brackets #:= name-set)
|
(remix:#%brackets #:= name-set)
|
||||||
|
;; xxx add set! if planner says so
|
||||||
(remix:#%brackets f name-f)
|
(remix:#%brackets f name-f)
|
||||||
...
|
...
|
||||||
#:extensions
|
#:extensions
|
||||||
|
|
|
@ -333,19 +333,22 @@
|
||||||
{p1.y ≡ 7}
|
{p1.y ≡ 7}
|
||||||
;; You will also get a copying function (XXX: Should it be named
|
;; You will also get a copying function (XXX: Should it be named
|
||||||
;; `copy`? `update`? My analogy here is with hash-set)
|
;; `copy`? `update`? My analogy here is with hash-set)
|
||||||
(def [posn p2] (p1.#:set [x 8] [y {p1.y + 2}]))
|
(def [posn p2] (p1.#:set [y {p1.y + 2}]))
|
||||||
;; Notice that these built-in functions are keywords, so that they
|
;; Notice that these built-in functions are keywords, so that they
|
||||||
;; can't conflict with the fields you've defined.
|
;; can't conflict with the fields you've defined.
|
||||||
{p2.x ≡ 8}
|
{p2.x ≡ 5}
|
||||||
{p2.y ≡ 9}
|
{p2.y ≡ 9}
|
||||||
;; This is aliased to =, which I expect is nicer to use.
|
;; This is aliased to =, which I expect is nicer to use.
|
||||||
(def [posn p3] (p1.#:= [x 8] [y {p1.y + 2}]))
|
(def [posn p3] (p1.#:= [x 8]))
|
||||||
{p3.x ≡ 8}
|
{p3.x ≡ 8}
|
||||||
{p3.y ≡ 9})
|
{p3.y ≡ 7})
|
||||||
|
|
||||||
|
;; XXX This is where I am
|
||||||
|
|
||||||
;; A layout can have a parent, which provides the guarantee that the
|
;; A layout can have a parent, which provides the guarantee that the
|
||||||
;; parent's functions will work on the child. A layout has one or zero
|
;; parent's functions will work on the child---meaning that whatever
|
||||||
;; parents.
|
;; the layout ends up being (and you can't decide that), the two will
|
||||||
|
;; overlap in this specific way. A layout has one or zero parents.
|
||||||
#;
|
#;
|
||||||
(def [layout quat]
|
(def [layout quat]
|
||||||
#:parent posn
|
#:parent posn
|
||||||
|
@ -353,7 +356,9 @@
|
||||||
|
|
||||||
;; A layout's fields may be specified as other layouts. When the first
|
;; A layout's fields may be specified as other layouts. When the first
|
||||||
;; field is a layout, this is not necessarily the same thing as a
|
;; field is a layout, this is not necessarily the same thing as a
|
||||||
;; parent (like C structs) but it may be.
|
;; parent (like C structs) but it may be. (No matter what, you'd never
|
||||||
|
;; be able to tell, since layout doesn't make representation promises
|
||||||
|
;; as a rule.)
|
||||||
#;
|
#;
|
||||||
(def [layout circle]
|
(def [layout circle]
|
||||||
[posn cx] r)
|
[posn cx] r)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user