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

The X and Z metaops don't respect Scalar containers as part of the 'single argument rule' #4705

Closed
p6rt opened this issue Oct 31, 2015 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Oct 31, 2015

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

Searchable as RT126522$

@p6rt
Copy link
Author

p6rt commented Oct 31, 2015

From @smls

S07 [https://github.com/perl6/specs/blob/master/S07-lists.pod] claims​:

  "The single argument rule does respect Scalar containers."
  "The single argument rule is implemented consistently throughout the language."

It lists 'for', '.push', 'infix​:<,>' and 'postcircumfix​:<[ ]>' as examples of
things that consistently follow the rule.

Since it does not explicitly mention the X and Z meta-operators as exceptions,
it stands to reason that they too should follow this rule.

But in current Rakudo they only follow it partially​: They treat each operand as
a single argument whose elements to act on, but they do *not* respect Scalar-containerization of said arguments.

Example​:

  say $(1, 2) X <a b c>

Output​:

  ((1 a) (1 b) (1 c) (2 a) (2 b) (2 c))

Expected output​:

  (((1 2) a) ((1 2) b) ((1 2) c))

TL;DR​: This is either a Rakudo bug, or a case where S07 needs more clarification.

@p6rt
Copy link
Author

p6rt commented Dec 15, 2015

From @jnthn

On Sat Oct 31 14​:12​:36 2015, smls75@​gmail.com wrote​:

S07 [https://github.com/perl6/specs/blob/master/S07-lists.pod] claims​:

"The single argument rule does respect Scalar containers."
"The single argument rule is implemented consistently throughout the
language."

It lists 'for', '.push', 'infix​:<,>' and 'postcircumfix​:<[ ]>' as
examples of
things that consistently follow the rule.

Since it does not explicitly mention the X and Z meta-operators as
exceptions,
it stands to reason that they too should follow this rule.

But in current Rakudo they only follow it partially​: They treat each
operand as
a single argument whose elements to act on, but they do *not* respect
Scalar-containerization of said arguments.

Example​:

say $(1, 2) X <a b c>

Output​:

((1 a) (1 b) (1 c) (2 a) (2 b) (2 c))

Expected output​:

(((1 2) a) ((1 2) b) ((1 2) c))

TL;DR​: This is either a Rakudo bug, or a case where S07 needs more
clarification.

Rakudo bug, and fixed now. Also roundrobin was vulnerable to a similar problem, and has also been fixed. Tests in S03-metaops/cross.t, S03-metaops/zip.t, and S32-container/roundrobin.t.

@p6rt
Copy link
Author

p6rt commented Dec 15, 2015

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

@p6rt p6rt closed this as completed Dec 15, 2015
@p6rt
Copy link
Author

p6rt commented Dec 15, 2015

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

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