Skip to content

Commonizing code between Fixed and Normed #139

Closed

Description

@kimikage

Fixed and Normed have evolved independently. Therefore, some functions are specialized even though they do not need specialization.

cf. ee5bd54...kimikage:commonize PR #151

I'm going to refactor the codes by taking the following 3 steps.

  1. Commonize the existing implementation code
  2. Add the functions which are implemented only in either (e.g. rounding functions for Fixed)
  3. Commonize the test codes

Although "test-first" is a good practice, the step 3. requires major renovations. Please give me your advice if you have any ideas.

Activity

  1. kimikage commented on Nov 21, 2019

    @kimikage
    Author
  2. added a commit that references this issue on Dec 30, 2019
  3. kimikage commented on Jan 22, 2020

    @kimikage
    CollaboratorAuthor

    Steps 1 and 2 are almost complete. Step 0 (the coding guidelines) is partially unfinished. Step 3 has not been started yet. I will keep this issue open until we have a concrete work plan.

  4. kimikage commented on Jul 26, 2020

    @kimikage
    CollaboratorAuthor

    I thought the test code was difficult to commonize. However, as I'll add tests for arithmetic operations, I am not very satisfied with the current test code.

    A practical problem is the long testing times. It's not fatal at the moment, but it should be an obstacle to supporting signed Normed in the future.
    We spend the most part of the testing time compiling. Therefore, except the reduction of memory allocation, optimization techniques for "run-time" speed has almost no effect. So it's important to reduce the number of test cases, or target types.
    Currently, 128-bit/64-bit types are tested, even though they are rarely used in practice. I believe that the reduction of the target type can be abstracted. For example, the following API can be considered:

    julia> target(Normed, (:i8, :i16), :light)
    (N7f1, N1f7, N0f8, N15f1, N9f7, N8f8, N7f9, N6f10, N5f11, N1f15, N0f16)
  5. kimikage commented on Jul 27, 2020

    @kimikage
    CollaboratorAuthor

    We can use include to do things like mix-in, but the unit of common reusable test sets are per file. That is incompatible with ”partially" commonizable test sets. @includetests of TestSetExtensions.jl also have the same problem.

    I devised (ugly) small macros like this:
    https://github.com/kimikage/CommonTests.jl

    The pair of macros @common and @runcommon use the names of the test sets to map the caller to the callee. However, I think there is a more elegant way.

  6. kimikage commented on Aug 30, 2020

    @kimikage
    CollaboratorAuthor

    The support for checked basic four operations is almost complete. Now that I know that those 100% tests are common to Fixed and Normed, I would like to commonize their codes. However, I'm not going to introduce any tricky macros, but simply write functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions