[m-rev.] for review: rename date/0 to date_time/0

Zoltan Somogyi zoltan.somogyi at runbox.com
Sat Mar 28 03:31:33 AEDT 2026



On Fri, 27 Mar 2026 19:45:23 +1100, Julien Fischer <jfischer at opturion.com> wrote:
> Rename date/0 to date_time/0.

A good idea.

> --- a/NEWS.md
> +++ b/NEWS.md
> @@ -226,6 +226,21 @@ Changes to the Mercury standard library
> 
>  ### Changes to the `calendar` module
> 
> +* The `date/0` type has been renamed to `date_time/0` and `date/0` is now
> +  a type synonym for `date_time/0` rather than the other way around, as
> +  previously.
> +
> +  The use of the name `date/0` is deprecated. Its meaning will be changed
> +  in a future release. As a result of this, the following predicates and
> +  functions are now obsolete:
> +
> +    - pred `init_date/8`            (replacement: `init_date_time/8`)
> +    - func `det_init_date/7`        (replacement: `det_init_date_time/7`)
> +    - pred `unpack_date/8`          (replacement: `unpack_date_time/8`)
> +    - pred `date_from_string/2`     (replacement: `date_time_from_string/2`)
> +    - func `det_date_from_string/1` (replacement:
> `det_date_time_from_string/1`)
> +    - func `date_to_string/1`       (replacement: `date_time_to_string/1`)
> +
>  * The following function and predicate have been added:
> 
>      - func `days_in_month/2`

You will need to explicitly list all the new replacement preds/funcs.


>      % Retrieve all the components of a date.
>      %
> -:- pred unpack_date(date::in,
> +:- pred unpack_date_time(date_time::in,
> +    year::out, month::out, day_of_month::out, hour::out, minute::out,
> +    second::out, microsecond::out) is det.
> +
> +:- pragma obsolete(pred(unpack_date/8), [unpack_date_time/8]).
> +:- pred unpack_date(date_time::in,
>      year::out, month::out, day_of_month::out, hour::out, minute::out,
>      second::out, microsecond::out) is det.

We usually put obsolete pragmas just after the affected declaration,
not before.

I think I can propose better wording of the news entry post-commit,
but the diff is otherwise fine.

Zoltan.


More information about the reviews mailing list