Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.
This repository was archived by the owner on Sep 22, 2024. It is now read-only.

An alternative way to call the streams? #16

@mdlkxzmcp

Description

@mdlkxzmcp

As much as I like the way of calling the streams with (limit: l, fraction_digits_limit: fl), it breaks most of the defdelegate macros as they don't support (AFAIK) passing keyword lists. So I think this is worthy of a discussion of how we want to shape the API. Now that we have so many generators, the orangeade.ex file in which all the defdelegate calls were stored is now a tiny bit messy. So wat do wat do man.

I see three ways of fixing this (I will be using the function from above as the example):

  1. We add a stream(limit, fraction_digits_limit) function to the file so that there are two ways of calling it, allowing us to defdelegate from the orangeade.ex file.
  2. We add a float(limit, fraction_digits_limit) function that works in the same way as the stream example above, but this allows us to minimize the noise in orangeade.ex file. (This will get rid of the , as: :stream part.
  3. We leave the code as is and forget about delegation, meaning that the API is more convoluted (Orangeade.float(limit, fraction_digits_limit) vs Orangeade.Generator.Float.stream(limit: l, fraction_digits_limit: fl), but this saves us the trouble of refactoring almost all the files to support the previous two APIs.

Personally I am all for the 2. way even though it requires a bit more work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions