-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More generic NamedTuple handling #42
Comments
I think automatically supporting anything that can be converted to Nanosecond is a huge footgun. It's not hard to imagine someone creating a timespan with e.g. Ints giving start/stop in seconds or milliseconds without fully understanding what's going on internally and having mysterious, silent breakage (when comparing to other spans with nanosecond-based times). |
(of course, the same goes for the |
Oh good point... mm... for now maybe the #41 should only accept tuples with |
Yeah, that's a very good point. Scratch that part then. |
As noted in #41 by @ararslan:
NamedTuple
s that have:start
and:stop
at minimum, possibly as part of a larger set of keys, e.g.(; start=Second(1), stop=Second(5), event="explosion")
. AFAICT the only real tradeoff is that you get anErrorException
rather than aMethodError
if you're missing:start
or:stop
.:start
and:stop
keys needn't beNanosecond
-valued or evenPeriod
-valued; in the same manner that e.g.TimeSpan(0, 10)
works, we could convert toNanosecond
as needed by definingNamedTuple
s for free. Hmmm.The text was updated successfully, but these errors were encountered: