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

Plural parameter names are alowed in .later and .earlier but not in .new (DateTime.new(years => 2016)) #4995

Open
p6rt opened this issue Jan 5, 2016 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Jan 5, 2016

Migrated from rt.perl.org#127162 (status was 'open')

Searchable as RT127162$

@p6rt
Copy link
Author

p6rt commented Jan 5, 2016

From @AlexDaniel

“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.

@p6rt
Copy link
Author

p6rt commented Jan 5, 2016

From @lizmat

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-archive.perl.org/perl6/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

@p6rt
Copy link
Author

p6rt commented Jan 5, 2016

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

@p6rt
Copy link
Author

p6rt commented Oct 11, 2017

From @AlexDaniel

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​:

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-archive.perl.org/perl6/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

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

No branches or pull requests

1 participant