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

Possible MMD issue when binding nqp::null() ?? #4351

Open
p6rt opened this issue Jun 26, 2015 · 3 comments
Open

Possible MMD issue when binding nqp::null() ?? #4351

p6rt opened this issue Jun 26, 2015 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 26, 2015

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

Searchable as RT125487$

@p6rt
Copy link
Author

p6rt commented Jun 26, 2015

From @lizmat

[10​:57​:16] <lizmat> m​: use nqp; my %h; %h<a> := nqp​::null() #hmmmm
[10​:57​:16] <+camelia> rakudo-moar 3d645f​: OUTPUT«Unexpected named parameter 'BIND' passed␤ in block <unit> at /tmp/GYnIiEF0VO​:1␤␤»

This looks strange to me, as we have the right candidate for this case​:

multi sub postcircumfix​:<{ }>( \SELF, \key ) is rw { # <— we fail here
  SELF.AT-KEY(key);
}
multi sub postcircumfix​:<{ }>(\SELF, \key, Mu :$BIND! is parcel) is rw { # <— ok candidate??
  SELF.BIND-KEY(key, $BIND);
}

Oddly enough, it looks like BIND-KEY *can* handle the case well​:

$ 6 'use nqp; my %h; %h.BIND-KEY("a",nqp​::null()); say %h.perl'
{​:a(Mu)}<>

A similar issue exists with binding nqp​::null() to array elements​:

$ 6 'use nqp; my @​a; @​a[0] := nqp​::null()'
Unexpected named parameter 'BIND' passed
  in block <unit> at -e​:1
$ 6 'use nqp; my @​a; @​a.BIND-POS(0,nqp​::null()); say @​a.perl'
[Mu]<>

I guess the dispatcher cannot see the difference between the absence of a value and nqp​::null()?

If this is a case of DIHWIDT, then so be it. I was just trying to see if we could make the :delete adverb more sensical for arrays, by making it splice. And introduce a new :null adverbs that would have the current semantics on arrays, and similar semantics on hashes (aka, effectively turning the hash into a SetHash with keys only).

Liz

@p6rt
Copy link
Author

p6rt commented Dec 3, 2017

From @AlexDaniel

Still reproducible (2017.11,HEAD(e5b660e))

On 2015-06-26 02​:25​:27, elizabeth wrote​:

[10​:57​:16] <lizmat> m​: use nqp; my %h; %h<a> := nqp​::null()
#hmmmm
[10​:57​:16] <+camelia> rakudo-moar 3d645f​: OUTPUT«Unexpected named
parameter 'BIND' passed␤ in block <unit> at /tmp/GYnIiEF0VO​:1␤␤»

This looks strange to me, as we have the right candidate for this
case​:

multi sub postcircumfix​:<{ }>( \SELF, \key ) is rw { # <— we fail
here
SELF.AT-KEY(key);
}
multi sub postcircumfix​:<{ }>(\SELF, \key, Mu :$BIND! is parcel) is rw
{ # <— ok candidate??
SELF.BIND-KEY(key, $BIND);
}

Oddly enough, it looks like BIND-KEY *can* handle the case well​:

$ 6 'use nqp; my %h; %h.BIND-KEY("a",nqp​::null()); say %h.perl'
{​:a(Mu)}<>

A similar issue exists with binding nqp​::null() to array elements​:

$ 6 'use nqp; my @​a; @​a[0] := nqp​::null()'
Unexpected named parameter 'BIND' passed
in block <unit> at -e​:1
$ 6 'use nqp; my @​a; @​a.BIND-POS(0,nqp​::null()); say @​a.perl'
[Mu]<>

I guess the dispatcher cannot see the difference between the absence
of a value and nqp​::null()?

If this is a case of DIHWIDT, then so be it. I was just trying to see
if we could make the :delete adverb more sensical for arrays, by
making it splice. And introduce a new :null adverbs that would have
the current semantics on arrays, and similar semantics on hashes (aka,
effectively turning the hash into a SetHash with keys only).

Liz

@p6rt
Copy link
Author

p6rt commented Dec 3, 2017

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

@p6rt p6rt added the weird label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant