Skip to content
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

Makes Interval lazy #20

Merged
merged 1 commit into from
Jul 14, 2016
Merged

Makes Interval lazy #20

merged 1 commit into from
Jul 14, 2016

Conversation

bethard
Copy link
Collaborator

@bethard bethard commented Jul 13, 2016

Makes start and end on Interval use def instead of val, and revises Interval implementations to use lazy val. The goal is to defer evaluation of things like UnknownInterval, which would otherwise cause anything that references them to throw an exception at construction time. Note that this required small changes in the test suite, because if neither start nor end is called, no exception will be produced.

I originally started down the path we had discussed for deferring this evaluation by making all the Interval operators into Interval => Intervals, but that ended up not really working out. For example, if ThisRepeatingInterval is an Interval => Interval and TwoDigitYear is an Interval => Interval, then it's not clear how to pass the TwoDigitYear as the Interval argument to ThisRepeatingInterval in a expression like "January of 89".

…es Interval implementations to use `lazy val`. The goal is to defer evaluation of things like `UnknownInterval`, which would otherwise cause anything that references them to throw an exception at construction time.
@bethard bethard self-assigned this Jul 13, 2016
@awmarkley
Copy link
Collaborator

awmarkley commented Jul 14, 2016

It seems like this solves the issue we were concerned about by protecting the parsing code from exploding during temporal operator normalization. I imagine when these temporal operators are examined for correctness we will know that we've found a relative TPZ when we hit an exception.

@bethard bethard merged commit 7d56da9 into master Jul 14, 2016
@bethard bethard deleted the lazy-interval branch July 14, 2016 20:53
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.

2 participants