Skip to content

Comments

Pass io to zeit.instant only when needed #59

Open
der-teufel-programming wants to merge 1 commit intorockorager:0.16from
der-teufel-programming:0.16-io-fix
Open

Pass io to zeit.instant only when needed #59
der-teufel-programming wants to merge 1 commit intorockorager:0.16from
der-teufel-programming:0.16-io-fix

Conversation

@der-teufel-programming
Copy link

No source other than now requires it

@rockorager
Copy link
Owner

Is there a pattern emerging here? I feel like passing it in on the config is not how this would be done with an allocator. What do you think about making it a nullable param?

fn instant(maybe_io: ?Io, ...)

@eamonburns
Copy link

Is there a pattern emerging here? I feel like passing it in on the config is not how this would be done with an allocator. What do you think about making it a nullable param?

fn instant(maybe_io: ?Io, ...)

I think it might be nicer to have two functions, one with a config, and one without but it takes an Io.

fn instant(config: Config)
fn instantNow(io: std.Io, tz: TimeZone)

The new instant function can internally pass an undefined io to the current implementation of instant.

@der-teufel-programming
Copy link
Author

I agree that separating creating now from creating an instant from another, constant, source could benefit the API

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants