#816: PMC 'Undef' does not support logical_not
-----------------------------+----------------------------------------------
 Reporter:  Austin_Hastings  |        Type:  bug   
   Status:  new              |    Priority:  normal
Milestone:                   |   Component:  core  
  Version:  1.3.0            |    Severity:  medium
 Keywords:                   |        Lang:        
    Patch:                   |    Platform:        
-----------------------------+----------------------------------------------

Comment(by bacek):

 Replying to [ticket:816 Austin_Hastings]:
 > This code in Close:
 > {{{
 >    ok(!(o.flat()), "flat: New object (undef flat) is false");
 > }}}
 > compiles to:
 > {{{
 >     $P51 = o."flat"()
 >     not $P52, $P51
 >     "ok"($P52, "flat: New object (undef flat) is false")
 > }}}
 > And then fails, with:
 > {{{
 > logical_not() not implemented in class 'Undef'
 > }}}

 Undef.logical_not was implemented in r41259.

 > Grepping for logical_not in *.pmc gives back only scalar.pmc.
 >
 >   * While I know that Perl's Undef has 0/nil/false/"" behavior, is that
 right for Parrot? (To what extent is Undef just a safe Null?)

 No. Undef is not "safe Null". Undef is something declared but not defined.
 Null is undeclared at all.

 >   * Should there even be a 'not' opcode? We've got isfalse.

 Some weird languages can have semantic of "Foo == !Foo" :)

 >   * Should other pmc types be implementing logical_not?

 Not all of them. But all scalar types probably should.

 >   * Should Undef be a subclass of scalar, and so inherit?

 It's actually really good idea from my point of view. I would recommend to
 open "RFC ticket" with this proposal.

 --
 Bacek

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/816#comment:1>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to