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

fix #13797 #13812

Merged
merged 1 commit into from
Mar 31, 2020
Merged

fix #13797 #13812

merged 1 commit into from
Mar 31, 2020

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented Mar 31, 2020

@Clyybber
Copy link
Contributor

Clyybber commented Mar 31, 2020

This is not a fix for #13797.
This merely "fixes" the repro snippet.
From the issue:

Without manual initialization, the common programming pattern of comparing a value to a default value is not possible

@timotheecour
Copy link
Member Author

timotheecour commented Mar 31, 2020

Without manual initialization, the common programming pattern of comparing a value to a default value is not possible

from my comment in that same bug report #13797 (comment)
this works:

when true:
  import times
  var d:DateTime
  if d == DateTime.default:
    echo "unchanged"

(which is why i wanted to add isDefault to stdlib (maybe in sugar) which would just be: if d.isDefault , see #13526)

@Clyybber
Copy link
Contributor

The issue here is that the default is bogus.

@Clyybber Clyybber closed this Mar 31, 2020
@Clyybber Clyybber reopened this Mar 31, 2020
ba0f3 added a commit to ba0f3/Nim that referenced this pull request Mar 31, 2020
I was update telebot to version 1.0.0, update folder structure follow `nimble` guideline
@timotheecour
Copy link
Member Author

The issue here is that the default is bogus.

in what sense? because the month is 0, which is invalid?
one way to fix that would be ot make months 0-based using an implicit offset of 1 (transparent change for users). But I'm not convinced yet thats needed; having an invalid default value is actually useful to check whether a value was initialized or not

narimiran pushed a commit that referenced this pull request Mar 31, 2020
…3814)

I was update telebot to version 1.0.0, update folder structure follow `nimble` guideline
@Araq Araq merged commit 1e4093d into nim-lang:devel Mar 31, 2020
@timotheecour timotheecour deleted the pr_fix_13797 branch March 31, 2020 22:30
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.

DateTime initializes to invalid state by default
3 participants