On 05/17/2012 02:13 AM, Parrot Raiser wrote: > While trying to convert some Perl 5 code to 6, I encountered problems > which golf down to: > > Perl 5 code >perl -e 'my $x = int (3 / 2); print $x, "\n";' > works >1 > > First try >./perl6 -e 'my $x = int ( 3 / 2); say $x;;' > >===SORRY!=== > >Confused > >at -e:1
int is a type, not an operator. Which is why int (3/2) is two terms in a row. If you want to convert to integer, use one of the rounder functions (floor(), ceiling(), truncate()) or .Int > Next go >./perl6 -e ' my $x = int(3 / 2); say $x ' > >invoke() not implemented in class 'int' > >in block <anon> at -e:1 That seems to be simply not yet implemented. > Some references to Int (note upper case I) in online examples led me to try > Upper-case I > >./perl6 -e 'my $x = Int ( 3 / 2); say $x;' > >===SORRY!=== > >Confused > >at -e:1 > > but finally >./perl6 -e 'my $x = Int( 3 / 2); say $x;' > works >1 > > Online searching didn't produce any unambiguous definition of int vs > Int, int is a native, machine-dependent number. Int is a transparent big integer type and a "proper" object which you can call methods not (which you can't on the native type) > or parenthesis spacing before functions. Well, those aren't fucntions, but type objects which you can invoke as coercers. And invocation is done with a postcircumfix(), and there are never spaces allowed between a term and a postcircumfix > That could be a > deficiency in my search terms or comprehension, but the error messages > aren't terribly helpful either. Yes, that's known, and not trivial to fix. STD and niecza give better parsing error messages. Cheers, Moritz