Skip to content

Commit

Permalink
Changes for elimination of /ONLY, add SPREAD
Browse files Browse the repository at this point in the history
The /ONLY refinement had been deprecated for some time, with
the idea that for operations like APPEND that it would be
the value getting appended that would carry the signal of
whether it should be spliced or not.

This idea had it that BLOCK! at quote level 0 would splice,
but at quote level > 0 would drop a quote level and not splice.
Then many types (such as WORD!) were disallowed from being
used at quote level 0, requiring to be quoted for safety.

Over time it became evident that a better idea would be to
let quote level 0 be "as is" and allow BLOCK! to have an
isotopic "quote level -1" as the splicing signal.  This
requires APPEND & friends to take the value as a ^META
argument, but the interpretation of the signals was already
basically having to do a "meta convention" behind the scenes.
This makes it official.

Massive changes are required to support this.  While it would
be more judicious to inventory and add them one by one, the
choice here is to go ahead with the pain of pushing it through
to see the impacts...
  • Loading branch information
hostilefork committed Jul 20, 2022
1 parent fd77660 commit 24c32de
Show file tree
Hide file tree
Showing 174 changed files with 1,698 additions and 1,688 deletions.
2 changes: 1 addition & 1 deletion configs/android-build-on-arm.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ REBOL [
]


toolset: compose2 [
toolset: compose [
gcc (tool-for-host/host <compiler> 'linux-arm)
ld (tool-for-host/host <linker> 'linux-arm)
]
Expand Down
2 changes: 1 addition & 1 deletion configs/android-cross-compiled.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ REBOL [
]


toolset: compose2 [
toolset: compose [
gcc (tool-for-host <compiler>) ; detect /host as current OS
ld (tool-for-host <linker>) ; same
]
Expand Down
2 changes: 1 addition & 1 deletion configs/bootstrap.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ REBOL [

os-id: 0.4.40

toolset: compose2 [
toolset: compose [
gcc (spaced [system/options/boot {--do "c99" --}])
ld (spaced [system/options/boot {--do "c99" --}])
]
2 changes: 1 addition & 1 deletion configs/default-config.r
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ with-tcc: no
pre-vista: no


git-commit: _
git-commit: null

includes: null
definitions: null
Expand Down
58 changes: 29 additions & 29 deletions configs/emscripten.r
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ optimize: "s"
;
; https://webassembly.org/roadmap/
;
extensions: make map! compose2 [
extensions: make map! compose [
BMP -
Clipboard -
Crypt -
Expand Down Expand Up @@ -139,8 +139,8 @@ extensions: make map! compose2 [
;
; Note environment variable EMCC_DEBUG for diagnostic output

cflags: compose2 [
((switch abrupt-failure-model [
cflags: compose [
(spread switch abrupt-failure-model [
#uses-try-catch [[
{-DREBOL_FAIL_USES_TRY_CATCH=1}
{-fwasm-exceptions} ; needed in cflags *and* ldflags
Expand All @@ -157,9 +157,9 @@ cflags: compose2 [
{-s DISABLE_EXCEPTION_CATCHING=1}
]]
fail
]))
])

((if debug-javascript-extension [[
(if debug-javascript-extension [spread [
{-DDEBUG_JAVASCRIPT_EXTENSION=1}

{-DDEBUG_HAS_PROBE=1}
Expand All @@ -168,22 +168,22 @@ cflags: compose2 [
{-DDEBUG_PRINTF_FAIL_LOCATIONS=1}

{-DDEBUG_COLLECT_STATS=1} ; !!! maybe temporary, has cost but good info
]]))
]])

((if use-asyncify [[
(if use-asyncify [spread [
{-DUSE_ASYNCIFY} ; affects rebPromise() methodology
]]))
]])
]

ldflags: compose2 [
ldflags: compose [
; We no longer test any configurations with asm.js (wasm is supported by
; all browsers of interest now). But you'd set this to 0 for that.
;
{-s WASM=1}

{-s DEMANGLE_SUPPORT=0} ; C++ build does all exports as C, not needed

((switch abrupt-failure-model [
(spread switch abrupt-failure-model [
#uses-try-catch [[
{-fwasm-exceptions} ; needed in cflags *and* ldflags
]]
Expand All @@ -194,17 +194,17 @@ ldflags: compose2 [
{-s DISABLE_EXCEPTION_CATCHING=1}
]]
fail
]))
])

(unspaced ["-O" optimize])

; Emscripten tries to do a lot of automatic linking "magic" for you, and
; seeing what it's doing might be helpful...if you can understand it.
; https://groups.google.com/forum/#!msg/emscripten-discuss/FqrgANu7ZLs/EFfNoYvMEQAJ
;
(comment {-s VERBOSE=1})
; ({-s VERBOSE=1})

((switch host [
(switch host [
#web [
if use-pthreads [
; https://github.com/emscripten-core/emscripten/issues/8102
Expand All @@ -217,21 +217,21 @@ ldflags: compose2 [
{-s ENVIRONMENT='node'}
]
fail "Javascript HOST must be [#web #node] in %emscripten.r"
]))
])

((if host = #node [
(if host = #node [
;
; !!! Complains about missing $SOCKFS symbol otherwise
;
{-s ERROR_ON_UNDEFINED_SYMBOLS=0}
]))
])

; Generated by %make-reb-lib.r, see notes there. Pertains to this:
; https://github.com/emscripten-core/emscripten/issues/4240
;
((if host = #node [
(if host = #node [
{--pre-js prep/include/node-preload.js}
]))
])

; The default build will create an emscripten module named "Module", which
; holds various emscripten state (including the memory heap) and service
Expand All @@ -245,21 +245,21 @@ ldflags: compose2 [
{-s MODULARIZE=1}
{-s 'EXPORT_NAME="r3_module_promiser"'}

((if debug-javascript-extension [
(if debug-javascript-extension [
{-s ASSERTIONS=1}
] else [
{-s ASSERTIONS=0}
]))
])

; Prior to Ren-C becoming stackless, it was necessary to use a fairly
; large value for the asyncify stack. If Asyncify is to be used again, it
; would probably not need a very large stack.
;
((if use-asyncify [
(if use-asyncify [
{-s ASYNCIFY_STACK_SIZE=64000}
]))
])

((if false [[
(if false [spread [
; In theory, using the closure compiler will reduce the amount of
; unused support code in %libr3.js, at the cost of slower compilation.
; Level 2 is also available, but is not recommended as it impedes
Expand All @@ -279,9 +279,9 @@ ldflags: compose2 [
;{-s IGNORE_CLOSURE_COMPILER_ERRORS=1} ; maybe useful?
{-g1} ; Note: debug level 1 can be used with closure compiler
{--closure 1}
]] else [[
]] else [ spread[
{--closure 0}
]]))
]])

; Minification usually tied to optimization, but can be set separately.
;
Expand Down Expand Up @@ -338,7 +338,7 @@ ldflags: compose2 [
;
;{-s ALLOW_MEMORY_GROWTH=0}

((if use-asyncify [[
(if use-asyncify [spread [
{-s ASYNCIFY=1}

; Memory initialization file,
Expand Down Expand Up @@ -372,9 +372,9 @@ ldflags: compose2 [
; whitelist needs true function names
;
{--profiling-funcs}
]]))
]])

((if use-pthreads [[
(if use-pthreads [spread [
{-s USE_PTHREADS=1} ; must be in both cflags and ldflags if used

; If you don't specify a thread pool size as a linker flag, the first
Expand All @@ -383,7 +383,7 @@ ldflags: compose2 [
; https://emscripten.org/docs/porting/pthreads.html
;
{-s PTHREAD_POOL_SIZE=1}
]]))
]])

; Asking to turn on profiling runs slower, but makes the build process
; *A LOT* slower.
Expand Down
12 changes: 6 additions & 6 deletions configs/wasi.r
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ wasi-sysroot: to file! (get-env 'WASI_SYSROOT else [
]
])

toolset: compose2 [
toolset: compose [
gcc (wasi-clang)
ld (wasi-clang)
]
Expand Down Expand Up @@ -98,7 +98,7 @@ optimize: if debug-wasi-extension [0] else ["s"]
;
; https://github.com/second-state/wasmedge-quickjs
;
extensions: make map! compose2 [
extensions: make map! compose [
BMP -
Clipboard -
Crypt -
Expand Down Expand Up @@ -134,7 +134,7 @@ extensions: make map! compose2 [
;
; Note environment variable EMCC_DEBUG for diagnostic output

cflags: compose2 [
cflags: compose [
{--sysroot ${WASI_SYSROOT}}

; "wasm lacks signal support; to enable minimal signal emulation..."
Expand All @@ -147,17 +147,17 @@ cflags: compose2 [

{-DREBOL_FAIL_JUST_ABORTS=1} ; no exceptions or setjmp()/longjmp()

((if debug-wasi-extension [[
(if debug-wasi-extension [spread [
{-DDEBUG_HAS_PROBE=1}
{-DDEBUG_FANCY_PANIC=1}
{-DDEBUG_COUNT_TICKS=1}
{-DDEBUG_PRINTF_FAIL_LOCATIONS=1}

{-DDEBUG_COLLECT_STATS=1} ; !!! maybe temporary, has cost but good info
]]))
]])
]

ldflags: compose2 [
ldflags: compose [
(unspaced ["-O" optimize])

{-lwasi-emulated-signal} ; cflags needs {-D_WASI_EMULATED_SIGNAL}
Expand Down
12 changes: 6 additions & 6 deletions extensions/console/ext-console-init.reb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export console!: make object! [
; name as "last-result", so it should keep the name it had before.
;
if block? v [
set 'last-result ~splice~ ; thinking being done on this...
set 'last-result ~spread~ ; thinking being done on this...
] else [
set 'last-result unmeta v
]
Expand Down Expand Up @@ -507,15 +507,15 @@ ext-console-impl: func [
][
switch type of item [
issue! [
if not empty? instruction [append/line instruction [,]]
if not empty? instruction [append/line instruction ',]
insert instruction item
]
text! [
append/line instruction compose [comment (item)]
append/line instruction spread compose [comment (item)]
]
block! [
if not empty? instruction [append/line instruction [,]]
append/line instruction compose/deep <*> item
if not empty? instruction [append/line instruction ',]
append/line instruction spread compose/deep <*> item
]
fail
]
Expand Down Expand Up @@ -869,7 +869,7 @@ ext-console-impl: func [
;
write-stdout unspaced [unclosed "\" _ _]
emit [reduce [ ; reduce will runs in sandbox
((<*> result)) ; splice previous inert literal lines
(<*> spread result) ; splice previous inert literal lines
system.console.input-hook ; hook to run in sandbox
]]

Expand Down
2 changes: 1 addition & 1 deletion extensions/debugger/ext-debugger-init.reb
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ backtrace*: function [
continue
]

keep ^(near of f)
keep near of f

; If building a backtrace, we just keep accumulating results as long
; as there are stack levels left and the limit hasn't been hit.
Expand Down
10 changes: 5 additions & 5 deletions extensions/event/make-spec.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ name: 'Event
source: %event/mod-event.c
includes: [%prep/extensions/event]

depends: compose2 [
depends: compose [
%event/t-event.c

((switch system-config/os-base [
(switch system-config/os-base [
'Windows [
[
spread [
[%event/event-windows.c]
]
]
] else [
[
spread [
[%event/event-posix.c]
]
]))
])
]

libraries: try switch system-config/os-base [
Expand Down
1 change: 1 addition & 0 deletions extensions/event/p-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Bounce Event_Actor(Frame(*) frame_, REBVAL *port, Symbol(const*) verb)

case SYM_INSERT:
case SYM_APPEND:
Unquotify_Dont_Expect_Meta(D_ARG(2));
if (not IS_EVENT(D_ARG(2)))
fail (D_ARG(2));
goto act_blk;
Expand Down
2 changes: 1 addition & 1 deletion extensions/filesystem/ext-filesystem-init.reb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sys.util.make-scheme [
init: func [return: <none> port <local> path] [
if url? port.spec.ref [
parse3 port.spec.ref [thru #":" 0 2 slash path:]
append port.spec compose [path: (to file! path)]
append port.spec spread compose [path: (to file! path)]
]
]
]
Expand Down
Loading

0 comments on commit 24c32de

Please sign in to comment.