Preludification Candidates


About Prelude.pm (in the pugs repository)

Note: This page is likely long-outdated.

src/perl6/Prelude.pm contains some core functions for Perl 6...written in Perl 6. Through a bootstrapping process, it is a available at runtime in an efficient, pre-compiled form.

Being able to write some of Perl 6 in a Perl 6 is a benefit it itself, but an additional benefit is that functions in Prelude.pm are automatically available to all Perl 6 implementations, helping spend of their development, and providing some consistency between them.

Hacking on Prelude.pm

Here's a rough shot at things that are implemented in src/Pugs/Prim.hs now and might be moved to src/perl6/Prelude.pm .

Some (many) of those rely on internals support to do the actual low-level stuff, for example IO. So it's (probably) okay to split up the work to a "myprim" sub in the Prelude and a sister "Pugs::Internals::myprim" in Prim. For example, Pipe.open2 offers a simple Perl6 interface to Haskell's runInteractiveCommand.

If your prim can be written efficiently in pure Perl6, that's great; by all means put it in the Prelude and mark it as such in a kwid block (FIXME: notation to be determined), so that it may be reused by non-pugsy Perl6 implementations :-)

If you have an questions about hacking on Prelude.pm, please ask on IRC

want
bool::true
bool::false
time
times
File::Spec::cwd
File::Spec::tmpdir
Str::split
lc
uc
capitalize
sort
reverse
perl
require_haskell
require_parrot
require_perl5
eval_parrot
use
require
eval
evalfile
eval_perl5
eval_haskell
eval_yaml
Pugs::Safe::safe_print
elems
graphs
codes
chars
bytes
readdir
slurp
opendir
IO::Dir::closedir
IO::Dir::rewinddir
IO::Dir::readdir
detach *rename to Thread.detach
kill *rename to Thread.kill and Process.kill
join *rename to Thread.join
async
listen *rename to Socket.listen
flush *rename to IO.flush
close *rename to IO.close / make multi?
chr
ord
hex
grep
map
join
reduce
Scalar::split
Scalar::as
connect *Socket.connect
sprintf
exec *Process.exec
system *Process.system
chmod *File? System?
index
rindex
substr