NAME ^

src/builtins/control.pir - Perl 6 Control functions

Functions ^

return

Create a return exception. (Only handles 1 return value for the moment -- we'll do more complex handling a bit later.)

die

exit

 multi Control::Basic::exit ( Int $status = 0)
Stops all program execution, and returns $status to the calling environment.

nothing

 multi Control::Basic::nothing ()
No operation. Literally does nothing.

sleep

 our Num multi Control::Basic::sleep ( Num $for = Inf )
Attempt to sleep for up to $for seconds. Implementations are obligated to support subsecond resolutions if that is at all possible.

[Q: what about multithreading? do we just sleep this thread? need to coordinate with entire async model. -law]

time

 our Time sub Control::Basic::time()
XXX Should be returning a (currently unspec'd, it seems) Time object that numifies to a floating point value giving the number of seconds and fractional seconds since 2000. At the moment, just handing back what the Parrot time opcode does, since that doesn't give something with a consistent epoch. Mails sent about both issues, will fix when answers come back.

eval

 multi Control::Basic::eval ( Str $code, Grammar :$lang = CALLER::<$?PARSER>)
Execute $code as if it were code written in $lang. The default is the language in effect at the exact location of the eval call.

Returns whatever $code returns, or undef on error. Sets caller's $! on error.

TODO: Functions ^

evalfile

 multi Control::Basic::evalfile (Str $filename : Grammar :$lang = Perl6)
Behaves like, and replaces Perl 5 do EXPR, with optional $lang support.

fail

TODO: Research the exception handling system.


parrot