[m-rev.] for review: store-based arrays

Julien Fischer jfischer at opturion.com
Mon Jun 6 11:02:49 AEST 2016


Hi Mark,

On Fri, 3 Jun 2016, Mark Brown wrote:

> On Fri, Jun 3, 2016 at 3:28 AM, Mark Brown <mark at mercurylang.org> wrote:
>> On Fri, Jun 3, 2016 at 1:12 AM, Mark Brown <mark at mercurylang.org> wrote:
>>> This is for review by anyone.
>
> Take two. I'd like to request a review, but general comments are also welcome.

What's the rationale for adding this?  (I don't have any objections but
am just curious ...)

...

> commit 5ccf4a9bfb1ff89ec5af4efeb30d243a190f9d41
> Author: Mark Brown <mark at mercurylang.org>
> Date:   Fri Jun 3 00:04:19 2016 +1000
>
>     Add mutable arrays to the store module.
>
>     library/store.m:
>     	Implement mutable arrays. These are essentially arrays from the
>     	array module with a store-based interface around them.
>
>     	Performing updates with this interface requires a new form of
>     	array.unsafe_set to be (privately) exported from the array module.
>
>     library/array.m:
>     	Define array updates in terms of very_unsafe_set, which takes
>     	a single array argument and a pair of store arguments, and
>     	updates the array in situ. In the case of unique arrays we use
>     	the array itself as the "store". This prevents the calls from
>     	being optimized away while still allowing inlining.
>
>     	Back-ends that do not use destructive update to implement arrays
>     	(namely, Erlang) must implement unsafe_set rather than
>     	very_unsafe_set; in this case the latter calls sorry/1, so
>     	attempts to use the new interface on these back-ends will
>     	currently abort.
>
>     	Export predicates for use by the new code in store.m.
>
>     NEWS:
>     	Announce the addition to the standard library.
> 
> diff --git a/NEWS b/NEWS
> index 5628bb5..dbb6262 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -130,6 +130,9 @@ Changes to the Mercury language:
>
>  Changes to the Mercury standard library:
> 
> +* We have added a new array type to the store module, in which arrays are
> +  ground values that are accessed via a unique store type such as io.

   ... such as the I/O state.

...

The rest looks fine, but I think you ought to provide more of the operations
from the array module, is_empty, min, max, various folds etc.

Julien.





More information about the reviews mailing list