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

Date can have undefined year #4921

Closed
p6rt opened this issue Dec 24, 2015 · 4 comments
Closed

Date can have undefined year #4921

p6rt opened this issue Dec 24, 2015 · 4 comments
Labels
Bug LHF Low-hanging fruit, easy to resolve

Comments

@p6rt
Copy link

p6rt commented Dec 24, 2015

Migrated from rt.perl.org#127016 (status was 'resolved')

Searchable as RT127016$

@p6rt
Copy link
Author

p6rt commented Dec 24, 2015

From zefram@fysh.org

Date.new permits the construction of a Date object with the undefined
Int type object as the year number. The undefined object can then be
retrieved through .year. Many other operations on the Date fail as a
result of the undefined year​:

Date.new(Int,1,1).year.perl
Int
Date.new(Int,1,1).Str
Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new?
Date.new(Int,1,1).perl
Use of uninitialized value $!year of type Int in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block <unit> at <unknown file> line 1
Date.new(,1,1)

It is nonsensical to construct a Date object that does not have a specific
integral year number. A better type constraint is required.

-zefram

@p6rt
Copy link
Author

p6rt commented Jan 5, 2018

From @zoffixznet

On Wed, 23 Dec 2015 20​:02​:51 -0800, zefram@​fysh.org wrote​:

Date.new permits the construction of a Date object with the undefined
Int type object as the year number. The undefined object can then be
retrieved through .year. Many other operations on the Date fail as a
result of the undefined year​:

Date.new(Int,1,1).year.perl
Int
Date.new(Int,1,1).Str
Invocant requires an instance of type Int, but a type object was
passed. Did you forget a .new?
Date.new(Int,1,1).perl
Use of uninitialized value $!year of type Int in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things,
if needed. in block <unit> at <unknown file> line 1
Date.new(,1,1)

It is nonsensical to construct a Date object that does not have a
specific
integral year number. A better type constraint is required.

-zefram

Thank you for the report. titsuki++ fixed this.

Fix​: rakudo/rakudo@038b1ea
Test​: Raku/roast@1ec04ae356

@p6rt
Copy link
Author

p6rt commented Jan 5, 2018

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 5, 2018

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jan 5, 2018
@p6rt p6rt added Bug LHF Low-hanging fruit, easy to resolve labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug LHF Low-hanging fruit, easy to resolve
Projects
None yet
Development

No branches or pull requests

1 participant