Skip Menu |
Report information
Id: 127162
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug [...] perl.org
Date: Tue, 5 Jan 2016 03:49:18 +0200
From: Aleks-Daniel Jakimenko-Aleksejev <alex.jakimenko [...] gmail.com>
Subject: Plural parameter names are alowed in .later and .earlier but not in .new (DateTime.new(years => 2016))
Download (untitled) / with headers
text/plain 739b
“year” is allowed everywhere:

Code:
say DateTime.new(year => -50).later(year => 50);

Result
0000-01-01T00:00:00


“years” is allowed in .later:

Code:
say DateTime.new(year => -50).later(years => 50);

Result
0000-01-01T00:00:00


Yet this is not allowed:

Code:
say DateTime.new(years => -50).later(years => 50);

Result
Cannot make a DateTime object using .new
  in block <unit> at -e line 1

Actually thrown at:
  in any  at gen/moar/m-Metamodel.nqp line 3041
  in block <unit> at -e line 1



<flussence> why does .later allow "year" and "years", but DateTime.new doesn't?

Indeed, not TIMTOWTDI-ish enough.
Also, if there is a final decision that it should not be allowed, then at least the error message should not be LTA.
Subject: Re: [perl #127162] Plural parameter names are alowed in .later and .earlier but not in .new (DateTime.new(years => 2016))
Date: Tue, 5 Jan 2016 14:28:43 +0100
To: "Alex Jakimenko (via RT)" <perl6-bugs-followup [...] perl.org>
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Download (untitled) / with headers
text/plain 1.5k
Show quoted text
> On 05 Jan 2016, at 02:49, Alex Jakimenko (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Alex Jakimenko > # Please include the string: [perl #127162] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=127162 > > > > “year” is allowed everywhere: > > Code: > say DateTime.new(year => -50).later(year => 50); > > Result > 0000-01-01T00:00:00 > > > “years” is allowed in .later: > > Code: > say DateTime.new(year => -50).later(years => 50); > > Result > 0000-01-01T00:00:00 > > > Yet this is not allowed: > > Code: > say DateTime.new(years => -50).later(years => 50); > > Result > Cannot make a DateTime object using .new > in block <unit> at -e line 1 > > Actually thrown at: > in any at gen/moar/m-Metamodel.nqp line 3041 > in block <unit> at -e line 1 > > > > <flussence> why does .later allow "year" and "years", but DateTime.new > doesn't? > > Indeed, not TIMTOWTDI-ish enough. > Also, if there is a final decision that it should not be allowed, then at > least the error message should not be LTA.
Alas, MMD doesn’t really make this easy. I actually started implementing this, but it will make things a *lot* slower. I’m not sure it warrants the effort. Now with regards to the LTAness of the error, I’ve committed 75c6b9e84ad74bcd5d5 which now shows: $ 6 'say DateTime.new(years => -50).later(years => 50)' Cannot call DateTime.new with these named parameters: years Which makes this ticket closable, as far as I’m concerned. Liz
I don't know if this should be implemented. But at the same time, isn't it just a matter of using an arg alias?

On 2016-01-05 05:29:15, elizabeth wrote:
Show quoted text
> > On 05 Jan 2016, at 02:49, Alex Jakimenko (via RT) <perl6-bugs-
> > followup@perl.org> wrote:
> >
> > # New Ticket Created by Alex Jakimenko
> > # Please include the string: [perl #127162]
> > # in the subject line of all future correspondence about this issue.
> > # <URL: https://rt.perl.org/Ticket/Display.html?id=127162 >
> >
> >
> > “year” is allowed everywhere:
> >
> > Code:
> > say DateTime.new(year => -50).later(year => 50);
> >
> > Result
> > 0000-01-01T00:00:00
> >
> >
> > “years” is allowed in .later:
> >
> > Code:
> > say DateTime.new(year => -50).later(years => 50);
> >
> > Result
> > 0000-01-01T00:00:00
> >
> >
> > Yet this is not allowed:
> >
> > Code:
> > say DateTime.new(years => -50).later(years => 50);
> >
> > Result
> > Cannot make a DateTime object using .new
> > in block <unit> at -e line 1
> >
> > Actually thrown at:
> > in any at gen/moar/m-Metamodel.nqp line 3041
> > in block <unit> at -e line 1
> >
> >
> >
> > <flussence> why does .later allow "year" and "years", but
> > DateTime.new
> > doesn't?
> >
> > Indeed, not TIMTOWTDI-ish enough.
> > Also, if there is a final decision that it should not be allowed,
> > then at
> > least the error message should not be LTA.
>
> Alas, MMD doesn’t really make this easy. I actually started
> implementing this, but it will make things a *lot* slower. I’m not
> sure it warrants the effort.
>
> Now with regards to the LTAness of the error, I’ve committed
> 75c6b9e84ad74bcd5d5 which now shows:
>
> $ 6 'say DateTime.new(years => -50).later(years => 50)'
> Cannot call DateTime.new with these named parameters: years
>
> Which makes this ticket closable, as far as I’m concerned.
>
>
> Liz




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org