remove spec and realize
They were too much surface for a language this small: a nominal contract layer, per-type default synthesis and a pub interface of their own. Type introspection and macros are the intended replacement, so the storage, the forms and the tests that pin them go; the ops method registry they leaned on stays. The implementation is kept at tag 0.0.1.
This commit is contained in:
@@ -145,12 +145,6 @@
|
||||
(let ((err (error-of sexc "--public-interface" "gen/broken.sex")))
|
||||
(and err (irregex-search "broken\\.sex:8: expanding boom: nope" err))))
|
||||
|
||||
;;; ...while a realization of a spec importers cannot see is refused by
|
||||
;;; the module that writes it, not by an importer naming it first
|
||||
(test-assert "a pub realization of a spec imported without pub is refused"
|
||||
(let ((err (error-of sexc "specs/money.sex" "-C" "-o" "-")))
|
||||
(and err (irregex-search "money.sex:8: importers cannot see this spec" err) #t)))
|
||||
|
||||
(test "the app runs through both"
|
||||
'("hello, world"
|
||||
"hello, sex"
|
||||
@@ -160,7 +154,6 @@
|
||||
"mood 1"
|
||||
"closure 15 21 201"
|
||||
"vec2 7 7"
|
||||
"vec2(3 4)"
|
||||
"tally 2"
|
||||
"board 42"
|
||||
"ledger 2"
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
(var v vec2 #(vec2 : 3 4))
|
||||
(printf "vec2 %d %d\n" (.manhattan v) (vec2/manhattan (& v)))
|
||||
|
||||
(.show-line v)
|
||||
|
||||
;; only the handle crossed: (. t n) here is an incomplete type
|
||||
(var t (* tally) (tally/make))
|
||||
(.bump t)
|
||||
|
||||
@@ -110,20 +110,6 @@
|
||||
;;; called, so there is no function for two units to both define.
|
||||
(pub sum colour ((rgb ((r int) (g int) (b int))) (none ())))
|
||||
|
||||
;;; A spec and a realization over the boundary. The written method
|
||||
;;; travels as a prototype and keeps external linkage; the default
|
||||
;;; does not travel at all -- the importer synthesizes its own static
|
||||
;;; copy from the spec, which is why a default is static even here.
|
||||
(pub spec (printable T)
|
||||
(fn show ((self (* const T))) void)
|
||||
(fn show-line ((self (* const T))) void
|
||||
(.show self)
|
||||
(printf "\n")))
|
||||
|
||||
(pub realize (printable vec2)
|
||||
(fn show ((self (* const vec2))) void
|
||||
(printf "vec2(%d %d)" (. self x) (. self y))))
|
||||
|
||||
;;; Not `pub': invisible to importers, and static in the generated C.
|
||||
(fn unused-helper () void
|
||||
(printf "private\n"))
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
;;; Imports shown without pub, so its importers cannot see the spec
|
||||
;;; this realizes: refused here, rather than in whichever importer
|
||||
;;; names money before shown
|
||||
(import shown)
|
||||
|
||||
(pub record money ((cents int)))
|
||||
|
||||
(pub realize (shown money)
|
||||
(fn show ((self (* const money))) int (return (. self cents))))
|
||||
@@ -1,2 +0,0 @@
|
||||
(pub spec (shown T)
|
||||
(fn show ((self (* const T))) int))
|
||||
Reference in New Issue
Block a user