Skip to content

Commit

Permalink
Leverage deciders in native type arguments
Browse files Browse the repository at this point in the history
This removes the built-in "typeset" wrappers like ANY-SERIES! so that natives
have to use the ANY-SERIES? function directly, which can be optimized by the
parameter construction to just run the functionality that the predicate runs
without a usermode function call.

Performance gets a not-inconsequential boost from this.
  • Loading branch information
hostilefork committed Feb 18, 2024
1 parent b6599df commit bc3ad1b
Show file tree
Hide file tree
Showing 106 changed files with 540 additions and 544 deletions.
4 changes: 2 additions & 2 deletions extensions/console/ext-console-init.reb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export console!: make object! [
add-shortcut: meth [
"Add/Change console shortcut"
return: [~]
name [any-word!] "Shortcut name"
name [any-word?] "Shortcut name"
block [block!] "Command(s) expanded to"
][
extend shortcuts name block
Expand Down Expand Up @@ -433,7 +433,7 @@ ext-console-impl: func [
prior "BLOCK! or GROUP! that last invocation of HOST-CONSOLE requested"
[<opt> block! group!]
result "^META result from evaluating PRIOR, or non-quoted error"
[<opt> error! quoted! quasiform!]
[<opt> error! quoted? quasi?]
resumable "Is the RESUME function allowed to exit this console"
[logic?]
skin "Console skin to use if the console has to be launched"
Expand Down
4 changes: 2 additions & 2 deletions extensions/dns/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## DNS Extension

R3-Alpha's DNS "port" was written to do forward and reverse resolves on
either URL! literals (a subclass of ANY-STRING!) or the TUPLE! datatype (a
either URL! literals (a subclass of ANY-STRING?) or the TUPLE! datatype (a
fairly narrow type, that could be a few byte-sized integers...used also for
color constants).

Expand Down Expand Up @@ -33,6 +33,6 @@ want asynchronous lookup are expected to use threads and call the standard
getnameinfo() API.

Considering the relatively low priority of the feature and its use of a
deprecated API, Ren-C removed the code--focusing instead on trying to clarify
deprecated API, Ren-C removed the code--focusing instead on trying to clarify
the port model and its synchronous/asynchronous modes in a more forward
looking way.
6 changes: 3 additions & 3 deletions extensions/filesystem/p-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//
// The current position meant that READ or WRITE which did not provide a /SEEK
// refinement of where to seek to would use that position, and advance the
// port's index past the read or write. But unlike with ANY-SERIES!, each
// port's index past the read or write. But unlike with ANY-SERIES?, each
// instance of a PORT! value did not have its own index. The position was a
// property shared among all references to a port.
//
Expand Down Expand Up @@ -662,7 +662,7 @@ Bounce File_Actor(Level* level_, REBVAL *port, const Symbol* verb)

//=//// SKIP ///////////////////////////////////////////////////////////=//
//
// !!! While each ANY-SERIES! value in historical Rebol has its own index,
// !!! While each ANY-SERIES? value in historical Rebol has its own index,
// all instances of the same PORT! would share the same index. This makes
// it likely that the operation should be called something different
// like SEEK.
Expand Down Expand Up @@ -699,7 +699,7 @@ Bounce File_Actor(Level* level_, REBVAL *port, const Symbol* verb)
// R3-Alpha CLEAR only supported open ports. We try working on non-open
// ports to just set the file to zero length. Though the most interesting
// case of that would be `clear %some-file.dat`, which won't work until
// the planned removal of FILE! from ANY-STRING! (it will interpret that
// the planned removal of FILE! from ANY-STRING? (it will interpret that
// as a request to clear the string).

case SYM_CLEAR: {
Expand Down
2 changes: 1 addition & 1 deletion extensions/javascript/mod-javascript.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ inline static REBVAL *Value_From_Value_Id(heapaddr_t id) {
//=//// JS-NATIVE PER-ACTION! DETAILS /////////////////////////////////////=//
//
// All Rebol ACTION!s that claim to be natives have to provide a BODY field
// for source, and an ANY-CONTEXT! that indicates where any API calls will
// for source, and an ANY-CONTEXT? that indicates where any API calls will
// be bound while that native is on the stack. For now, if you're writing
// any JavaScript native it will presume binding in the user context.
//
Expand Down
2 changes: 1 addition & 1 deletion extensions/network/mod-network.c
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ DECLARE_NATIVE(shutdown_p)
//
// return: "NULL if timeout, PORT! that awoke or BLOCK! of ports if /ALL"
// [<opt> port! block!]
// value [<opt> any-number! time! port! block!]
// value [<opt> any-number? time! port! block!]
// ]
//
DECLARE_NATIVE(wait_p) // See wrapping function WAIT in usermode code
Expand Down
2 changes: 1 addition & 1 deletion extensions/odbc/ext-odbc-init.reb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ sqlform: func [
tuple! [mold value]

; !!! We need to express literal SQL somehow. Things like 'T' might be
; legal SQL but it's a bad pun to have that be a QUOTED! WORD! named
; legal SQL but it's a bad pun to have that be a QUOTED? WORD! named
; {T'}. The only answers we have are to either use full on string
; interpolation and escape Rebol variables into it (not yet available)
; or to make it so a string in SQL is double-stringed, e.g. {"foo"}.
Expand Down
2 changes: 1 addition & 1 deletion extensions/odbc/mod-odbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ SQLRETURN ODBC_BindParameter(
"'~true~ [", rebI(SQL_C_BIT), "]",
"'~false~ [", rebI(SQL_C_BIT), "]",
"] else [",
"fail {Legal QUASIFORM!-parameters ~null~ ~true~ ~false~}",
"fail {Legal QUASI?-parameters ~null~ ~true~ ~false~}",
"]",
"]",

Expand Down
2 changes: 1 addition & 1 deletion extensions/stdio/mod-stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ DECLARE_NATIVE(read_char)
// For the moment there aren't any other signals; if there were,
// they may be interesting to the caller.
//
assert(!"Unknown QUASIFORM! signal in Try_Get_One_Console_Event()");
assert(!"Unknown QUASI? signal in Try_Get_One_Console_Event()");
return e;
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/encap.reb
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ pe-format: context [
let def: make block! 1
let find-a-word: func [
return: [~]
word [any-word!]
word [any-word?]
][
any [
find words to word! word
Expand Down
8 changes: 4 additions & 4 deletions src/boot/errors.r
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Script: [

bad-utf8: {invalid UTF-8 byte sequence found during decoding}
codepoint-too-high: [{codepoint} :arg1 {too large (or data is not UTF-8)}]
illegal-zero-byte: {#{00} bytes illegal in ANY-STRING!, use BINARY!}
illegal-zero-byte: {#{00} bytes illegal in ANY-STRING?, use BINARY!}
illegal-cr: [{Illegal CR: See DELINE, and TO-TEXT/RELAX:} :arg1]
mixed-cr-lf-found: {DELINE requires files to be CR LF or LF consistently}
bad-utf8-bin-edit: {String aliased as BINARY! can't become invalid UTF-8}
Expand All @@ -104,8 +104,8 @@ Script: [
ambiguous-infix: {Ambiguous infix expression--use GROUP! to clarify}
literal-left-tuple: {Use >- to pass literal left TUPLE! parameters right}

sequence-too-short: {ANY-PATH! and ANY-TUPLE! must have more than 2 items}
bad-sequence-item: [{Value is not a valid ANY-SEQUENCE! element:} :arg1]
sequence-too-short: {ANY-PATH? and ANY-TUPLE? must have more than 2 items}
bad-sequence-item: [{Value is not a valid ANY-SEQUENCE? element:} :arg1]
cant-decorate-type: [{Cannot apply `:` or `^` decoration to:} :arg1]

action-with-dotted: {ACTION! used with dotted sequence access form}
Expand Down Expand Up @@ -231,7 +231,7 @@ Script: [
varargs-no-look: {VARARGS! may only lookahead by 1 if "hard quoted"}
varargs-take-last: {VARARGS! does not support TAKE-ing only /LAST item}

null-vararg-array: {Can't MAKE ANY-ARRAY! from VARARGS! that allow <opt>}
null-vararg-array: {Can't MAKE ANY-ARRAY? from VARARGS! that allow <opt>}
null-object-block: {Can't create block from object if it has null values}

conflicting-key: [:arg1 {key conflicts; use SELECT or PUT with /CASE}]
Expand Down
Loading

0 comments on commit bc3ad1b

Please sign in to comment.