[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH][5] Use more descriptive names in typematch

From: Evan Hanson
Subject: Re: [Chicken-hackers] [PATCH][5] Use more descriptive names in typematch-tests.scm
Date: Thu, 26 Apr 2018 16:25:59 +0200

Hi megane,

On 2018-03-30 10:55, megane wrote:
> while I was reading the file I decided to refactor the tests a bit.

I like this, it's much more clear.

> The macro checkp wasn't quite doing what it was supposed to.
> Checkp tests that predicates work. The statement (checkp PRED TYPE
> VALUE) tries to assert that in a branch where (PRED VALUE) is true the
> type of VALUE is TYPE.
> There were these two tests that passed (with new checkp argument order) :
> (checkp boolean? true #t)
> (checkp boolean? false #f)
> I replaced them with:
> (checkp boolean? boolean #t)
> (checkp boolean? boolean #f)

Too true, thank you for fixing that.

> Then these three:
> The types in successful branches are *, number and number,
> respectively. Indeed, none of those functions are declared predicates.
> Maybe they should be?
> (checkp exact? fixnum '1)
> (checkp inexact? float '1.2)

These two cannot be predicates since they signal an error when an
invalid (i.e. non-numeric) argument is provided.

> (checkp real? number (+ n))

This one could be made a predicate for (or fixnum flonum bignum ratnum).
I can't think of a reason not to do this, presently... But that's for
another patch.

Signed-off version attached.


Attachment: 0001-Use-more-descriptive-names-in-typematch-tests.scm.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]