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

A returned () is a Nil but doesn't smartmatch against one #783

Closed
p6rt opened this issue Mar 15, 2009 · 6 comments
Closed

A returned () is a Nil but doesn't smartmatch against one #783

p6rt opened this issue Mar 15, 2009 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Mar 15, 2009

Migrated from rt.perl.org#63894 (status was 'rejected')

Searchable as RT63894$

@p6rt
Copy link
Author

p6rt commented Mar 15, 2009

From @masak

<masak> rakudo​: sub foo { return }; say foo.WHAT; say ?(foo ~~ Nil)
<p6eval> rakudo 5b1ff9​: OUTPUT«Nil␤0␤»
* masak submits

Expected behavior​: a "Nil" and a 1. Or an explanation about why a
value shouldn't smartmatch successfully against its own type.

@p6rt
Copy link
Author

p6rt commented Jul 16, 2009

From @kyleha

On Sun Mar 15 08​:36​:42 2009, masak wrote​:

Expected behavior​: a "Nil" and a 1. Or an explanation about why a
value shouldn't smartmatch successfully against its own type.

<pmichaud> KyleHa​: n ~~ Nil is the same as n( ~( ~Nil ) )
<KyleHa> pmichaud​: Is that how it should be or just how it is right now?
<pmichaud> Well, unless we special-case prefix;<~~> to do something
else, that's "how it should be"
<pmichaud> i.e., it's the same as n ~ ~ Nil

I wrote tests for this behavior in S02-builtin_data_types/nil.t

@p6rt
Copy link
Author

p6rt commented Jul 16, 2009

From @pmichaud

On Sun Mar 15 08​:36​:42 2009, masak wrote​:

<masak> rakudo​: sub foo { return }; say foo.WHAT; say ?(foo ~~ Nil)
<p6eval> rakudo 5b1ff9​: OUTPUT«Nil␤0␤»
* masak submits

Expected behavior​: a "Nil" and a 1. Or an explanation about why a
value shouldn't smartmatch successfully against its own type.

Note that "foo ~~ Nil" is the same as "foo(~~Nil)" which is the same as
"foo(~(Nil))". In other words, it's not a smartmatch operator here,
it's two prefix​:<
>s.

Rejecting ticket.

Pm

@p6rt
Copy link
Author

p6rt commented Jul 16, 2009

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

@p6rt
Copy link
Author

p6rt commented Jul 16, 2009

@pmichaud - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Jul 16, 2009
@p6rt
Copy link
Author

p6rt commented Jul 17, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in b/t/spec/S02-builtin_data_types/nil.t

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