[m-rev.] for review: clean up bitmap.m
Julien Fischer
jfischer at opturion.com
Sat Jan 1 14:04:12 AEDT 2022
On Sat, 1 Jan 2022, Zoltan Somogyi wrote:
> Eliminate overuse of ^s in library/bitmap.m.
>
> library/bitmap.m:
> Replace all uses of field access notation for things that are not
> structure fields with getter functions and setter predicates.
> Add the getter functions and setter predicates where they did not
> exist before. Unlike the old "field :=" functions, the new setter
> predicates lend themselves to state variable notation.
>
> Replace nested applications of functions with sequences of calls
> (usually a get/modify/set sequence) that is easier to read and
> understand, partly because it gives meaningful names to the
> intermediate values.
>
> Where an operation was available as both a function and a predicate,
> implement the function version in terms of the predicate version,
> as is our convention in the rest of the Mercury implementation,
> instead of vice versa.
>
> In a few cases, where implementing the function in terms of the predicate
> could lead to misleading exceptions (that refer to the name of the
> predicate, not the function, even when the user called the function),
> have two copies of the implementation that differ only in the
> text of the exception(s) being thrown.
>
> NEWS:
> Document the added exported functions and predicates.
>
> tests/hard_coded/bitmap_empty.m:
> Replace io.write/io.nl sequences with io.write_line, including
> one case where the io.nl was missing :-(
>
> Fix misleading indentation.
That's fine.
Julien.
More information about the reviews
mailing list