Check the functional-perl website for properly formatted versions of these documents.
<with_toc>
Guide
This is to give a quick overview of what should be done next. If you'd like to scan through all possible work (or like to lose yourself), see "Items" below.
- Finish
FP::AST::Perland reworkFP::Abstract::Showto use it. - Find the people potentially interested in this project.
- Collect and discuss open questions, perhaps via RFC processes,
including:
- General design and structure
- Plan automatic lexical lifetime and TCO analysis
- Perl AST in C to make it efficient?
- Decide where to go with the experimental approaches taken,
including:
- Preferred way to create functional classes (
FP::Structor?) - Preferred way to make abstract classes and/or protocols.
- Preferred way for equality (
FP::Abstract::Equal) and comparison (FP::Abstract::Compare)
- Preferred way to create functional classes (
- Use for some (experimental) projects, gain experience, report/fix bugs.
- Videos (screen recordings), articles, talks.
Consistency
-
pointer_eqvs.boolean_equalis probably inconsistent ("equal is always about the content, eq is about pointer identity", fine, but,eqis taken, and if you make it long, just use the same naming approach?) -
boolean_equalshould be in aFP::Booleanlibrary. Speaking of which: what about a real boolean type, so thatequalwill know how to work with them? That would probably go there.
Items
This is an unsorted collection of items to work on.
See also [[ideas]], [[htmlgen/TODO]], [[functional_XML/TODO]] and the "todo" markers in text (website / .md) files. Also, the [[names]] page.
Features
-
add a
pairkeysmethod toFP::Abstract::Sequence(doing the equivalent of->chunks_of(2)->map(the_method "first")orList::Util1.29's function of the same name) -
: you may find https://metacpan.org/pod/Sub::Identify useful, and https://perldoc.perl.org/Sub::Util#set_subname lets you set a sub name for anonymous subs that is helpful for such debugging, especially when installing anonymous subs in non-anonymous places.
FP::Showis already usingSub::Util, have a look if there's anything to improve. Provide an easy way to tag closures with names?
Work on the code
-
In bin/perlrepl and bin/fperl, use the proper perl version in the shebang line; yet, still allow them to be run locally (project not installed). How?
-
rename "hidden" methods like
FP_Equal_equalto all-uppercase likeFP_EQUAL__EQUALas that seems to be preferred (TO_JSONwas given as an example) -
Finish unmerged work on FP::Repl (see note from this commit in [intro])
-
See entries in BUGS pod sections (e.g.
FP::ShowandFP::Equalcycles,FP::Replbugs) -
FP::Failure: add tests. Solve thecomplementissue (which would mean, make FP::Result and use that)? Also:failure, since it overloads boolean, can basically only be used in boolean contexts, where the non-failure case is just true, since otherwise (the success case is itself a boolean) it would be dangerous in handling. -
Add an Error data type, similar to
FP::Failure, but which wraps the success case as well? -
Consistently use "{ package Foo; ... }" or "package Foo { ... }" (latter if compatible with the minimal required Perl version)
-
Rename
is_nulltois_empty? I'm torn.nulltoempty? -
Should I or should I not move modules that implement functions to
FP::Lib::or something? They are still about a type; butFP::Arraymay break it (will want to useFP::Arrayas the class, henceFP::Lib::Arrayfor the functions?) -
Rename
FP::StructtoFP::Define::Struct? -
Make generic functions (for sequences) that work with both objects (which implement the method of the same name) and non-objects that are of the same kind; e.g.
first([3, 4])andfirst(list 3, 4)would both return3. (Will conflict in the case ofmapwith the built-in, though.) -- May not be useful enough any more given that there's nowFP::autobox. -
Immutable and mutable blessed strings?
-
Currently
purearray(3,4)->cons(2)->map(\&inc)is broken. Figure out which way to go, perhaps implementFP::Vecfirst? How does Clojure handle it again? -
In
t/pod_snippets, remove entries from the ignore list and fix their pod snippets. Also, now that pod snippets can be tested directly, remove duplicates of tests e.g. int/fp-struct(and in general move tests to POD?) -
Systematically go through the docs and update it. Use/make something like POD snippets for markdown and change the docs to use examples and then automatically check that they are up to date.
-
Make the remaining pure datastructures immutable, unless requested by user (using similar approach like taken in
FP::List), e.g. StrictList; and them toFP::Abstract::Pure. -
Change
FP::Structto allow mutable private fields that don't impedeFP::Abstract::Pure(see comments in FP::Struct)? -
Consistently
use Scalar::Util qw(reftype)? What was the point again of using this overreforUNIVERSAL::isaforCODEand such? -
die vs. croak: die is nice since
FP::Repl::Trapwill go to the real location, how is the situation with croak? (Also,Chj::Backtrace?) InFP::Repl, skip call frames withinCarpand similar likeFP::Repl::WithRepl(maybe the same way calling code fromCarp, or perhapsTrace::Mask)? -
Would it be possible to write either an XS module that allows to cancel an ongoing
diefrom within a$SIG{__DIE__}handler, or one that allows to set up another hook for die (in all relevant cases likedie ..,1/0,use warnings FATAL => ..). -
Idea: set slots to an object that reads like "value optimized away" (perhaps an object of class
FP::_ValueOptimizedAway_) instead of to undef when letting go of values (OK,weakenuses undef of course; but possibly weaken won't be necessary anymore once lexical analysis exists and the interpreter can handle deletions at the call site) -
Add a
boolean_eqfunction? -
Show: handle cycles; pretty printing. Also, add an auto-forcing dynamic parameter and print immediately instead of building a string (have
showjust capture that)? -
Be consistent with exceptions,
array_drop [4], 3should probably give one. -
Add tests (or move existing ones over?) across all sequences (i.e. add test suites for protocols)
-
Rename FP::Abstract:: to FP::Protocol:: (and then probably also
FP::InterfacetoFP::Protocol)? (Pro: "implement a protocol" or "using the foo protocol" sounds better than "implement an abstract class" or "following the foo abstract class"; con: protocol can be mistaken as a wire protocol. "Mixin" isn't the proper term especially since this term seems to be understood to not add to @ISA; "interface" means just the call interface (no method definitions in the interface), with no base functionality that is required to work.) -
Get
Sub::Call::Tailworking again, or replace it with something new (really just an OP tree transformation)? -
Get a prototype for lexical analysis (for automating the letting go of stream heads) in Scheme and produce Perl code to do the same. Then see how to implement it in the Perl interpreter (enabled with pragma).
-
Implement a recursive let syntax,
my rec? -
Implement a range abstraction/data type. Implement sequence protocol.
-
Sequence optimization:
$foo->prep->map(..)->filter(..)->map(..)->listto optimize away intermediate data structures. (See Clojure's transducers.) -
Reference count based optimization: mutate if there's only a single holder.
-
Consistency check: any method/function that returns a maybe or perhaps type must be named appropriately, otherwise throw exceptions on errors. Or: Error data type above?
-
Implement
FP::Vec, a data structure with both efficient functional updates and efficient random access. RandomAccessSequence protocol. Then hash maps with the same properties. (In C for speed? For algorithms, see Clojure.) -
Add ->[$i] to RandomAccessSequence protocol. Move ref and set over to RandomAccessSequence protocol?
-
FP::Repl::Trap,FP::Repl::AutoTrap, tests: checkDEBUGorBACKTRACEor similar env var(s) to make it possible to enable permanently in the code but stay really safe (never break the situation for any user). Write docs about it. -
Similar to the above point,
RUN_TESTSshould be streamlined / automated (any program should ~by default allow to have its tests run by simply setting this env var (OK?);perhaps_run_testsdoes part of the job). -
For type checks in
FP::Struct(perhaps move those out to separate module), as well as maybe protocol checks: have warning and die modes, selectable via env variable? Also, disable completely for speed via same mechanism (but that one would be compile time?)? -
Chj::TESTshould compare viaFP::Equal; resulting values likelist(1,2,3)can then be used. OK not to handle values that do not implement the protocol? -
Should (most) prototype declarations really be removed? (Pro: equal(@_) doesn't work, any similar issues?;
is equal $a,$b, $cdoesn't work anyway; con: why provide a syntactically rich language if it's not to be used (but, where does it help?)) -
Add a Changes file.
-
e.g. when implementing
FP::Interfaces, how to collect the values from all super classes? Well, useNEXT::and make these methods folds (take a rest argument)! -
Mostly eliminate the use of
FP::DumperEqual(replace withFP::Equal). Also, makeTESTuseequalso that there's no need to->array. -
Make
FP::StrictListimplementFP::Abstract::Sequence. -
Repl: support language server protocol for IDE integration?
-
Get rid of
test.plscript, as this is old style and not necessary anymore? But I'm setting an env var and define the ordering there, how? -
Perhaps do not use all-lowercase module namings
-
Test::Needshas been recommended overTest::Requires"for reasons specified in its documentation", look into it. -
Performance: look into inlining for speed sensitive code? Have a look at
Class::XSAccessor, or mst mentioned some underdocumented crazy way.
Get rid of unnecessary home-grown code
These may better be replaced by more widely used code, roughly in the order of most likely replacement (those replaced most easily or usefully listed first).
-
Chj::xperlfunc: maybeuse autodie, although I'm somewhat wary of the fact that this way it's not directly visible anymore whether a call dies or not. Also, there are various utilities like xspawn, xxsystem etc. that need replacing, too. -
Chj::xopen*,Chj::xtmpfile,Chj::xpipe,Chj::IO::* -
should
Chj::TESTstay or be made a lexical extension of other test modules? -
migrate
FP::Structfunctionality as Moose extensions or something? -
merge FP::Repl with other repls/debuggers? Also, Chj::{FP::Repl::Trap,WithRepl,Backtrace}. They are still fertile grounds for experimentation, though, thus shouldn't merge things too soon.
-
maybe
FP::Pathis not general or useful enough to keep
Licensing
-
should I move the licensing statements from the top of the files into the POD section of each file?
-
should I specify a license for the text? A different one than the ones for the code? Who should be the copyright holder of the website, "the project"?
Documentation and tests
-
document the change in recent (blead) perl with regards to lexical capture and weak references (e.g. see
FP::DBIcommit 8862338..) in the howto -
more
intro/, moreexamples/ -
more tests:
-
more systematic stream leak testing. Idea: LEAK_TEST forms in
Chj::TEST(see comment inFP::Stream) -
tests for
Chj::TESTitself -
systematic testing of mixed FP::List / FP::PureArray etc. sequences. (etc.)
-
Other people's code
-
change dependency on
Math::BigIntinto a recommendation? -
remove recommendation of
Method::Signatures, experimental signatures are enough? -
should FunctionalPerl feature tags only import those whose dependencies are satisfied? Probably, to make
fperlwork. -
replace
FP::LazywithData::Thunk? This would be cool from a transparency stand point, except that separate code by way of dynamic dispatch (method calls) can't be used anymore then, and thus the only code always needs to do the environment cleaning, which is bad from a usability perspective since users not working with lazy data will still have their variables (unexpectedly) deleted. Also, when aData::Thunkthunk (promise) fails, it won't be run again and is instead silently casted to e.g. an integer in number context, which will be a usability neightmare.Also, what about
Params::Lazy? -
Sub::Call::Taildepends onB::Hooks::OP::Check::EntersubForCVwhich doesn't work on current bleadperl. Get this fixed.Reimplement it on top of
Devel::CallCheckerorDevel::CallParser?(Would it be obsolete if automatic TCO is implemented?)
-
replace Chj::IO::* with something else?
-
work on getting perl issues fixed, see failing tests
t/perl-* -
disable stringification and numerification lexically using "no stringification"? But it currently doesn't work with bleadperl anymore. -> Just suggest in docs?
-
extend Data::Dumper (or alternative dumper(s)) to show a simpler syntax for linked lists, and streams (and perhaps more) (mostly for the repl, but also in general):
FP::list(1,2,3) # instead of bless [1, bless [2, bless ...],...(Show only evaluated part of streams (and the rest as a promise), or force evaluation of the first n items then cut off the same way as for lists?)
Code structure
-
fix the now horrible hand-optimized-but-convoluted code in
PXML::Serialize(and figure out an automatic way to make it fast). -
finish PXML's HTML5 support.
-
improve sequences class hierarchy
-
look at Ord (Ordering) in Haskell etc.
-
avoid the duplication between
FP::ListandFP::Streamas much as possible.- those not using lazy internally: implement the List variants using Keep and the stream variants.
-
-
what to do about data types that have both a class and some functions, like
is_sequence, that now lives inFP::Predicates, and might be moved elsewhere in the future, breaking code importing it...? -
messages like "expecting 2 arguments" are unclear and inconsistently used for functions reused as methods. How should it be?
flipshould work, for example, so do we have to live with methods including $self in their argument count? (For this reason, much of the code is now simply throwing the message "wrong number of arguments" without any indication of the expected count.Function::Parametersissues "Too many arguments" and "Not enough arguments",Method::Signaturessays "missing required argument $a" or "was given too many arguments", both of which are good.) -
should
rest(cdr) weaken its argument in the case of streams? (firstclearly shouldn't, right?) -
add
FP::List'snoneand theallalias (also, removeeveryorall?) toFP::Stream, or to common base class.
Security, safety
- check 'XX.*[Ss]ecurity' comments
Possibilities
- port
PXML::ElementtoFP::Struct(it was originally written before that existed, iirc). Create a version/extension ofFP::Structthat uses arrays instead of hashes, or is that irrelevant and stupid? (benchmark cpu and memory)
</with_toc>