Skip to content

Cpp suggestions - #741

Open
asarhaddon wants to merge 19 commits into
kanaka:masterfrom
asarhaddon:cpp-suggestions
Open

Cpp suggestions#741
asarhaddon wants to merge 19 commits into
kanaka:masterfrom
asarhaddon:cpp-suggestions

Conversation

@asarhaddon

Copy link
Copy Markdown
Contributor

Hello. Here are some suggestions for the c++ implementation.

Compute system name with only one subprocess.
Use predefined Make rules and variables when possible.
Keep *FLAGS from the environment or command line.
Allow the Make command line to override for example the -O option.
Split LDLIBS from LDFLAGS and CPPFLAGS from CXXFLAGS.
Pass compiler flags to the linker (this is necessary for -Og, safe otherwise).
Best viewed with `git diff -b`, only the indentation changes.
This will help when applying the same patch to each step.
In steps8A, unique_ptr was forgotten during the EVAL/macroexpand
merge. Simply remove the dynamic allocation.
Minimize the .h interface.
Drop unused C headers.
Avoid C++ strings for encapsulated manipulations.
Only write once the history at program exit.
Add a macro producing debug information.
Report errors with the history file (but do not crash tests for that).
Create it when it is missing.
Remove the confusing NULL env work-around from EVAL.

Copy integer operations from step2 to step3 so step3 does not require
Core.
Merge rep and safeRep.
FIX: errors during the non-interactive startup are now reported.

Move the implementation of value_cast<T> from Types.h to .cpp so that
it can see all headers.

Remove the confusing malEmptyInputException.
Simplify try* accordingly.
Ensure that Types does not need Environmen for steps 12.
 * Remove the dependency on EVAL (which differs between steps23).
 * Embed a closure into malLambda.
 * Move symbol evaluation to steps (it differs between steps 23).
 * Add an fmap function to malVector and malHash.
 * Remove malLambda::makeEnv because its implementation needs to call
   a malEnv function (the constructor).
Move implementations from Types.h to .cpp so that they are not
compiled on each inclusion.

Encapsulate the representation of maps, and change it from binary
trees to hash maps.

Avoid a level of reference in sequences (like for maps) and remove the
last explicit destructor.  Also make them mutable and improve
encapsulation.

Merge both isEqual functions.

Merge both withMeta functions.

Add optional override qualifiers, only mark as virtual the methods
intended for override.
This fixes the memory leaks caused by cycles like
  (let* [f (fn* [] nil)] nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant