Skip to content

Commit

Permalink
Rename $not-supplied to $unsupplied.
Browse files Browse the repository at this point in the history
In Open Dylan, this constant is called $unsupplied, so it is easier
if both use the same name.
  • Loading branch information
waywardmonkeys committed Nov 4, 2015
1 parent 2fcfa70 commit d86b163
Show file tree
Hide file tree
Showing 20 changed files with 125 additions and 126 deletions.
8 changes: 4 additions & 4 deletions libraries/dylan/array.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ end class <multiD-array>;
// General array methods

define method make (c == <array>,
#key dimensions: dimensions :: <sequence> = $not-supplied,
#key dimensions: dimensions :: <sequence> = $unsupplied,
fill = #f)
=> array :: <array>;
if (dimensions == $not-supplied)
if (dimensions == $unsupplied)
error("Need the dimensions or a size for an array");
elseif (size(dimensions) = 1)
make(<vector>, fill: fill, size: head(dimensions));
Expand Down Expand Up @@ -244,9 +244,9 @@ end method initialize;


define method element (array :: <multiD-array>, index :: <integer>,
#key default: default = $not-supplied)
#key default: default = $unsupplied)
=> elt :: <object>;
if (default == $not-supplied)
if (default == $unsupplied)
array.contents-slot[index];
else
element(array.contents-slot, index, default: default);
Expand Down
8 changes: 4 additions & 4 deletions libraries/dylan/coll.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ define open generic key-test
// we must define a default method for all collections.
//
define method element(coll :: <collection>, key :: <object>,
#key default = $not-supplied) => obj :: <object>;
#key default = $unsupplied) => obj :: <object>;
let (init-state, limit, next-state, done?,
current-key, current-element) = forward-iteration-protocol(coll);
let test = key-test(coll);
Expand All @@ -109,7 +109,7 @@ define method element(coll :: <collection>, key :: <object>,
return(current-element(coll, state));
end if;
finally
if (default == $not-supplied)
if (default == $unsupplied)
error("No such element in %=: %=", coll, key);
else
default;
Expand Down Expand Up @@ -575,12 +575,12 @@ define open generic subsequence-position


define method element(sequence :: <sequence>, key :: <integer>,
#key default = $not-supplied) => elt :: <object>;
#key default = $unsupplied) => elt :: <object>;
block (return)
for (this-key from 0, elem in sequence)
if (this-key == key) return(elem) end if;
finally
if (default == $not-supplied)
if (default == $unsupplied)
error("No such element in %=: %=", sequence, key);
else
default;
Expand Down
8 changes: 4 additions & 4 deletions libraries/dylan/deque.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,10 @@ end method size-setter;
// to the desired element and take that as our starting point.
//
define method element (deque :: <deque>, key :: <integer>,
#key default = $not-supplied) => elt :: <object>;
#key default = $unsupplied) => elt :: <object>;
let sz = deque.size;
if (key < 0 | key >= sz)
if (default == $not-supplied) error("No such element in %=: %d", deque, key)
if (default == $unsupplied) error("No such element in %=: %d", deque, key)
else default
end if;
elseif (key + key > sz) // closer to end than start
Expand Down Expand Up @@ -801,13 +801,13 @@ end method reverse!;
// Returns the last element of the deque. This is more efficient because
// the last element of a deque can be accessed directly.
//
define method last (deque :: <deque>, #key default = $not-supplied)
define method last (deque :: <deque>, #key default = $unsupplied)
=> last-elt :: <object>;
let deque-tail = deque-tail(deque);
case
deque-tail =>
deque-element-data(deque-tail);
default == $not-supplied =>
default == $unsupplied =>
error("No such element in %=: last.", deque);
otherwise =>
default;
Expand Down
4 changes: 2 additions & 2 deletions libraries/dylan/ext.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ define constant ignore =
// If the given key is present in the collection, return #t and the value
// associated with the key. Otherwise, return #f and an undefined value.
//
// Can't use $not-supplied, because we're passing undefined as an
// argument to element(), which itself probably uses $not-supplied..
// Can't use $unsupplied, because we're passing undefined as an
// argument to element(), which itself probably uses $unsupplied..
//
define constant undefined = pair(#f, #f);
define constant key-exists? =
Expand Down
4 changes: 2 additions & 2 deletions libraries/dylan/extern.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ end method size-setter;
// should use pointer-value instead.
//
define method element
(vec :: <c-string>, index :: <integer>, #key default = $not-supplied)
(vec :: <c-string>, index :: <integer>, #key default = $unsupplied)
=> (result :: <character>);
let sz = vec.size;
case
index >= 0 & index < sz =>
pointer-value(vec, index: index);
default == $not-supplied =>
default == $unsupplied =>
error("No such element in %=: %=", vec, index);
otherwise =>
default;
Expand Down
2 changes: 1 addition & 1 deletion libraries/dylan/library.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ define module extras
*debug-output*, *warning-output*, *inspect-function*, *xinspect-function*,
<format-string-condition>, report-condition,
condition-format, condition-force-output,
ratio, integer-length, $not-supplied, false-or, instantiable?,
ratio, integer-length, $unsupplied, false-or, instantiable?,
add-debug-variable;
end;

Expand Down
2 changes: 1 addition & 1 deletion libraries/dylan/misc.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ define method find-method
find-method(gf, as(<list>, specializers));
end method find-method;

define constant $not-supplied = pair(#f, #f);
define constant $unsupplied = pair(#f, #f);

define sealed generic instantiable? (type :: <type>) => answer :: <boolean>;

Expand Down
10 changes: 5 additions & 5 deletions libraries/dylan/range.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -391,25 +391,25 @@ end method;
// signalled.
//
define method element (range :: <bounded-range>, key :: <integer>,
#key default = $not-supplied)
#key default = $unsupplied)
=> range-element :: <real>;
case
(key >= 0) & (key < range.range-size) =>
range.range-from + (key * range.range-by);
(default == $not-supplied) =>
(default == $unsupplied) =>
error ("No such element in %=: %d", range, key);
otherwise =>
default;
end case;
end method;
//
define method element (range :: <unbounded-range>, key :: <integer>,
#key default = $not-supplied)
#key default = $unsupplied)
=> range-element :: <real>;
case
(key >= 0) =>
range.range-from + (key * range.range-by);
(default == $not-supplied) =>
(default == $unsupplied) =>
error ("No such element in %=: %d", range, key);
otherwise =>
default;
Expand Down Expand Up @@ -804,7 +804,7 @@ end method;
// Returns the element at RANGE-SIZE - 1. Signals an error for
// unbounded ranges.
//
define method last (range :: <bounded-range>, #key default = $not-supplied)
define method last (range :: <bounded-range>, #key default = $unsupplied)
=> last-elt :: <object>;
element (range, range.range-size - 1, default: default)
end method;
Expand Down
4 changes: 2 additions & 2 deletions libraries/dylan/stretchy.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ end method dimensions;


define method element(ssv :: <simple-stretchy-vector>, key :: <integer>,
#key default = $not-supplied)
#key default = $unsupplied)
=> elt :: <object>;
case
key >= 0 & key < size(ssv) =>
ssv-data(ssv)[key];
default == $not-supplied =>
default == $unsupplied =>
error("Element %d not in %=", key, ssv);
otherwise =>
default;
Expand Down
8 changes: 4 additions & 4 deletions libraries/dylan/table.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ end method find-elt;
// to avoid race conditions with the garbage collector.
//
define method element (ht :: <table>, key :: <object>,
#key default: default = $not-supplied )
#key default: default = $unsupplied )
=> elt :: <object>;
// We don't yet check for outdated hash states, since the element
// might match anyway, and the lookup is much cheaper than a rehash.
Expand All @@ -477,7 +477,7 @@ define method element (ht :: <table>, key :: <object>,
elseif (~ht.table-hash-state.state-valid? | ~key-state.state-valid?)
rehash(ht);
element(ht, key, default: default);
elseif (default == $not-supplied)
elseif (default == $unsupplied)
error("Element not found");
else
default;
Expand All @@ -487,7 +487,7 @@ end method element;
// This is exactly the same code without the garbage collection stuff
//
define method element ( ht :: <value-table>, key,
#key default: default = $not-supplied )
#key default: default = $unsupplied )
=> elt :: <object>;
let (key=, key-hash) = table-protocol(ht);
let key-id = key-hash(key, ht.table-hash-state);
Expand All @@ -497,7 +497,7 @@ define method element ( ht :: <value-table>, key,

if (find-result)
find-result.entry-elt;
elseif (default == $not-supplied)
elseif (default == $unsupplied)
error ("Element not found");
else
default;
Expand Down
2 changes: 1 addition & 1 deletion libraries/io/library.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ define module print
use system, import: { <raw-pointer> };
#endif
use extensions,
import: {$minimum-integer, $not-supplied, <byte-character>,
import: {$minimum-integer, $unsupplied, <byte-character>,
<ratio>, numerator, denominator};
export
print, print-object, print-to-string,
Expand Down
48 changes: 24 additions & 24 deletions libraries/io/print.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -346,23 +346,23 @@ define generic print (object, stream :: <stream>,
=> ();


define constant <boolean-or-not-supplied>
= type-union(<boolean>, singleton($not-supplied));
define constant <integer-or-false-or-not-supplied>
= type-union(<integer>, one-of(#f, $not-supplied));
define constant <boolean-or-unsupplied>
= type-union(<boolean>, singleton($unsupplied));
define constant <integer-or-false-or-unsupplied>
= type-union(<integer>, one-of(#f, $unsupplied));

/// Print -- Method for Exported Interface.
///
/// This method must regard the values of the keywords and construct a
/// <print-stream> to hold the values for the requested print operation.
///
define method print (object, stream :: <stream>,
#key level :: <integer-or-false-or-not-supplied>
= $not-supplied,
length :: <integer-or-false-or-not-supplied>
= $not-supplied,
circle? :: <boolean-or-not-supplied> = $not-supplied,
pretty? :: <boolean-or-not-supplied> = $not-supplied)
#key level :: <integer-or-false-or-unsupplied>
= $unsupplied,
length :: <integer-or-false-or-unsupplied>
= $unsupplied,
circle? :: <boolean-or-unsupplied> = $unsupplied,
pretty? :: <boolean-or-unsupplied> = $unsupplied)
=> ();
block ()
//
Expand All @@ -378,10 +378,10 @@ define method print (object, stream :: <stream>,
let p-stream = make-a-print-stream(stream);
//
// Set slots with those values supplied by the user.
if (~ (level == $not-supplied)) p-stream.print-level := level end;
if (~ (length == $not-supplied)) p-stream.print-length := length end;
if (~ (circle? == $not-supplied)) p-stream.print-circle? := circle? end;
if (~ (pretty? == $not-supplied)) p-stream.print-pretty? := pretty? end;
if (~ (level == $unsupplied)) p-stream.print-level := level end;
if (~ (length == $unsupplied)) p-stream.print-length := length end;
if (~ (circle? == $unsupplied)) p-stream.print-circle? := circle? end;
if (~ (pretty? == $unsupplied)) p-stream.print-pretty? := pretty? end;
//
// When printing circularly, we first print to a "null stream" so that we
// can find the circular references.
Expand Down Expand Up @@ -422,12 +422,12 @@ end method;
/// <print-stream> to hold the values for the requested print operation.
///
define method print (object, stream :: <print-stream>,
#key level :: <integer-or-false-or-not-supplied>
= $not-supplied,
length :: <integer-or-false-or-not-supplied>
= $not-supplied,
circle? :: <boolean-or-not-supplied> = $not-supplied,
pretty? :: <boolean-or-not-supplied> = $not-supplied)
#key level :: <integer-or-false-or-unsupplied>
= $unsupplied,
length :: <integer-or-false-or-unsupplied>
= $unsupplied,
circle? :: <boolean-or-unsupplied> = $unsupplied,
pretty? :: <boolean-or-unsupplied> = $unsupplied)
=> ();
let save-level = stream.print-level;
let save-length = stream.print-length;
Expand All @@ -440,7 +440,7 @@ define method print (object, stream :: <print-stream>,
// continue printing with the minimum effect of the two levels, assuming
// that is the most careful thing to do.
case
(level == $not-supplied) => #f; // Case is broken in Mindy.
(level == $unsupplied) => #f; // Case is broken in Mindy.
(save-level) =>
stream.print-level := min(save-level, (level + stream.print-depth));
otherwise => stream.print-level := level;
Expand All @@ -449,14 +449,14 @@ define method print (object, stream :: <print-stream>,
// continue printing with the minimum of the two lengths, assuming that
// is the most careful thing to do.
case
(length == $not-supplied) => #f; // Case is broken in Mindy.
(length == $unsupplied) => #f; // Case is broken in Mindy.
(save-length) => stream.print-length := min(save-length, length);
otherwise => stream.print-length := length;
end;
// We never turn off circular printing, but if a recursive call to print
// turns circular printing on, we print that object circularly.
case
((circle? == $not-supplied) | (~ circle?)) =>
((circle? == $unsupplied) | (~ circle?)) =>
#f; // Case is broken in Mindy.
(~ save-circle?) =>
stream.print-circle? := #t;
Expand All @@ -466,7 +466,7 @@ define method print (object, stream :: <print-stream>,
// passed to print. The assumption is that there is no harm in turning
// it off for some object, and because it is odd to request no pretty
// printing, the calling code probably has good reason to turn it off.
if (~ (pretty? == $not-supplied)) stream.print-pretty? := pretty? end;
if (~ (pretty? == $unsupplied)) stream.print-pretty? := pretty? end;
//
// Determine whether, and how, to print object.
maybe-print-object(object, stream);
Expand Down
Loading

0 comments on commit d86b163

Please sign in to comment.