First of all, there are a few background changes that I made for building, etc.:
We now have stronger warning compile flags so that they pop up in CLion.
New class MissingImplementationException should be used to point out TODO-type stuff to make it even more apparent that there is a hole in the code. This means that whenever code triggers this, or when we want to search for missing implementations, this will be another tool we can use to track it down (by the class name).
In Data, certain changes were also made:
INVALID typed values are now called UNSPECIFIED, as the "unspecified" keyword comes up in R7RS a few times, so it made more sense to call it this.
get now returns a reference to the asked type if it is currently inside of the Data (or throws a shaka::TypeException. Please review whether it is necessary to use references to allow ourselves to directly set the car or cdr for a DataPair if we're trying to get a DataPair from a Data (we don't want to modify a copy -- we want to modify the actual data!)
Here is a basic implementation of DataPairs that holds two references to other Data.
NodePtr is a using alias that resolves to std::shared_ptr<shaka::Data> for now. It is known that this implementation is broken if we are dealing with reference cycles that may appear due to the presence of circular lists, etc. We are expecting to replace this faulty implementation of managed data pointers in the future with a proper garbage collection system that is designed to detect cycle detection and break ownership chains as necessary for proper memory management.
It implements four major functions:
car
cdr
set_car
set_cdr
Please also review whether my implementation of deep copying of Data to other Data in the copy constructor in Data(const Data& other) is correct. I'm not sure if it is.
First of all, there are a few background changes that I made for building, etc.:
MissingImplementationException
should be used to point out TODO-type stuff to make it even more apparent that there is a hole in the code. This means that whenever code triggers this, or when we want to search for missing implementations, this will be another tool we can use to track it down (by the class name).In
Data
, certain changes were also made:INVALID
typed values are now calledUNSPECIFIED
, as the "unspecified" keyword comes up in R7RS a few times, so it made more sense to call it this.get
now returns a reference to the asked type if it is currently inside of the Data (or throws ashaka::TypeException
. Please review whether it is necessary to use references to allow ourselves to directly set the car or cdr for a DataPair if we're trying to get a DataPair from a Data (we don't want to modify a copy -- we want to modify the actual data!)Here is a basic implementation of DataPairs that holds two references to other Data.
NodePtr
is ausing
alias that resolves tostd::shared_ptr<shaka::Data>
for now. It is known that this implementation is broken if we are dealing with reference cycles that may appear due to the presence of circular lists, etc. We are expecting to replace this faulty implementation of managed data pointers in the future with a proper garbage collection system that is designed to detect cycle detection and break ownership chains as necessary for proper memory management.It implements four major functions:
car
cdr
set_car
set_cdr
Please also review whether my implementation of deep copying of Data to other Data in the copy constructor in
Data(const Data& other)
is correct. I'm not sure if it is.