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

Comparison ops for DateTimes in Rakudo #4380

Closed
p6rt opened this issue Jul 5, 2015 · 7 comments
Closed

Comparison ops for DateTimes in Rakudo #4380

p6rt opened this issue Jul 5, 2015 · 7 comments
Labels
NYI Features not yet implemented testneeded

Comments

@p6rt
Copy link

p6rt commented Jul 5, 2015

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

Searchable as RT125555$

@p6rt
Copy link
Author

p6rt commented Jul 5, 2015

From @masak

<masak> hm, we have comparison ops for Date objects but not for
DateTime objects... this is probably an oversight.
<masak> m​: my $dt1 = DateTime.now; my $dt2 = $dt1.later(​:1hour); say $dt1 < $dt2
<camelia> rakudo-moar 5919a8​: OUTPUT«Cannot call Real(DateTime​: ); [...]
* masak submits NYI rakudobug

@p6rt
Copy link
Author

p6rt commented Aug 22, 2015

From @labster

Not sure this is an oversight. S02 says that comparison ops coerce to Num, doc says that they coerce with Real. Either way, me (and TimToady) aren't so sure that we should be overloading comparison operators in the core language. The wrong part might be the Date comparsions.

I guess we could have a Numeric form of a DateTime, like DateTime.now.Instant.tai, but that doesn't seem to have the same kind of type safety. We can implement infix​:<cmp>, so infix​:<before> and <after> would work, but despite being the perfect word, it's too general for type checking.

On Sun Jul 05 05​:12​:10 2015, masak wrote​:

<masak> hm, we have comparison ops for Date objects but not for
DateTime objects... this is probably an oversight.
<masak> m​: my $dt1 = DateTime.now; my $dt2 = $dt1.later(​:1hour); say
$dt1 < $dt2
<camelia> rakudo-moar 5919a8​: OUTPUT«Cannot call Real(DateTime​: );
[...]
* masak submits NYI rakudobug

@p6rt
Copy link
Author

p6rt commented Aug 22, 2015

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

@p6rt
Copy link
Author

p6rt commented Sep 7, 2015

From @labster

Comparison ops added in dac0167a, but I still feel like this behavior runs counter to S03#​1332.

On Sat Aug 22 16​:33​:41 2015, labster wrote​:

Not sure this is an oversight. S02 says that comparison ops coerce to
Num, doc says that they coerce with Real. Either way, me (and
TimToady) aren't so sure that we should be overloading comparison
operators in the core language. The wrong part might be the Date
comparsions.

I guess we could have a Numeric form of a DateTime, like
DateTime.now.Instant.tai, but that doesn't seem to have the same kind
of type safety. We can implement infix​:<cmp>, so infix​:<before> and
<after> would work, but despite being the perfect word, it's too
general for type checking.

On Sun Jul 05 05​:12​:10 2015, masak wrote​:

<masak> hm, we have comparison ops for Date objects but not for
DateTime objects... this is probably an oversight.
<masak> m​: my $dt1 = DateTime.now; my $dt2 = $dt1.later(​:1hour); say
$dt1 < $dt2
<camelia> rakudo-moar 5919a8​: OUTPUT«Cannot call Real(DateTime​: );
[...]
* masak submits NYI rakudobug

@p6rt
Copy link
Author

p6rt commented Oct 3, 2017

From @AlexDaniel

I'd say it's TESTNEEDED for now. Maybe the the stuff from S03 should be spec-ed in tests and then we can have a separate ticket asking for these changes.

On 2015-09-06 20​:11​:24, labster wrote​:

Comparison ops added in dac0167a, but I still feel like this behavior
runs counter to S03#​1332.

On Sat Aug 22 16​:33​:41 2015, labster wrote​:

Not sure this is an oversight. S02 says that comparison ops coerce
to
Num, doc says that they coerce with Real. Either way, me (and
TimToady) aren't so sure that we should be overloading comparison
operators in the core language. The wrong part might be the Date
comparsions.

I guess we could have a Numeric form of a DateTime, like
DateTime.now.Instant.tai, but that doesn't seem to have the same kind
of type safety. We can implement infix​:<cmp>, so infix​:<before> and
<after> would work, but despite being the perfect word, it's too
general for type checking.

On Sun Jul 05 05​:12​:10 2015, masak wrote​:

<masak> hm, we have comparison ops for Date objects but not for
DateTime objects... this is probably an oversight.
<masak> m​: my $dt1 = DateTime.now; my $dt2 = $dt1.later(​:1hour);
say
$dt1 < $dt2
<camelia> rakudo-moar 5919a8​: OUTPUT«Cannot call Real(DateTime​: );
[...]
* masak submits NYI rakudobug

@p6rt
Copy link
Author

p6rt commented Feb 3, 2018

From @moritz

Tests added in Raku/roast@ff0472adfc

@p6rt
Copy link
Author

p6rt commented Feb 3, 2018

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

@p6rt p6rt closed this as completed Feb 3, 2018
@p6rt p6rt added NYI Features not yet implemented testneeded labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NYI Features not yet implemented testneeded
Projects
None yet
Development

No branches or pull requests

1 participant