RobThree / IdGen

Twitter Snowflake-alike ID generator for .Net
MIT License
1.19k stars 148 forks source link

Non-generic IIdGenerator #39

Closed glen-84 closed 1 year ago

glen-84 commented 1 year ago

I'm curious why the IIdGenerator interface is generic – aren't the values always long?

Maybe there could be a non-generic interface using long internally?

RobThree commented 1 year ago

Currently there's only long; the idea is/was that maybe sometime in the future another type is added. I don't see that happening but you never know 😉

glen-84 commented 1 year ago

It would be a bit neater to just inject IIdGenerator. 🙂

RobThree commented 1 year ago

Something something hindsight 20/20.

I can't change this without breaking everyone's code and, quite honestly, I don't see the problem.

glen-84 commented 1 year ago

I can't change this without breaking everyone's code and, quite honestly, I don't see the problem.

I'm not sure what the breaking change would be, IdGenerator could implement both IIdGenerator and IIdGenerator<long>, with the latter being deprecated.

Anyway, it's not critical, just a suggestion.

RobThree commented 1 year ago

I'm not sure what the breaking change would be

Ah, I see. I meant that if I would replace the interface things would break. But, yes, I could add an interface. I just think it clutters the interfaces.