#1445: Add ResizableStringArray.get_number VTABLE function
-----------------------------+----------------------------------------------
 Reporter:  Austin_Hastings  |       Owner:                                     
       
     Type:  todo             |      Status:  new                                
       
 Priority:  normal           |   Milestone:                                     
       
Component:  none             |     Version:  2.0.0                              
       
 Severity:  medium           |    Keywords:  rsa, ResizableStringArray, 
get_number, NQP
     Lang:                   |       Patch:                                     
       
 Platform:                   |  
-----------------------------+----------------------------------------------

Comment(by Austin_Hastings):

 Note that the first array here is a PMC array, because NQP creates the
 objects individually. The second is a RSA because that's what split
 returns.
 {{{
 aus...@andlinux:~/kakapo$ cat test.nqp
 my @strap := ('Foo', 'Bar');

 if @strap > 1 {
         say("strap ynam toG");
 }

 my $str := "Foo::Bar";
 my @parts := pir::split__PSS('::', $str);

 if @parts > 1 {
         say("Got many parts");
 }

 aus...@andlinux:~/kakapo$ parrot-nqp test.nqp
 strap ynam toG
 get_number() not implemented in class 'ResizableStringArray'
 current instr.: '_block11' pc 0 (EVAL_1:6)
 called from Sub 'parrot;PCT;HLLCompiler;eval' pc -1 ((unknown file):-1)
 called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1303
 (src/PCT/HLLCompiler.pir:707)
 called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1489
 (src/PCT/HLLCompiler.pir:794)
 called from Sub 'parrot;NQP;Compiler;main' pc -1 ((unknown file):-1)
 }}}

 To your first point, while I'm not entirely comfortable with it, I can
 understand that there's no difference between get_number() and
 int2float(get_int()).

 The second point is an NQP issue. Patrick's got math working, and if the
 price of that was that everything is an $N register, so be it. There's no
 way to go from float to int because int is virtually unheard of in NQP.

 Third, the PMC type already has get_number. The other two, I can't say -
 they haven't appeared on my radar since they aren't naturally generated
 anywhere. I agree it were better to be consistent - by all means make sure
 they all DTRT.

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/1445#comment:2>
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