Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull-request contains a "struct" implementation, which currently allows structures to be defined - as a list of fields, and objects created assuming all fields are present. One a struct has been created magical methods allow type-checking and field access/updates.
This will close #82, once complete.
Sample usage, which works with this pull-request:
Here you'll notice that the struct is actually a hash, and we're merely setting the named fields as key/val pairs.
This is pretty smart, all we've really done is recorded the fields a structure should contain, and hooked into our execution to instantiate a new hash when we see a named structure - before falling back to invoking a command instead.
The bit that's missing?
Adding accessors was a little tricky, but we store the name of the faux method in a map with the appropriate field as the value. This allows accesses to be found and updates to be made.
The biggest issue here is that we're doing extra checks on the "hot path", so the whole eval method is getting deeply complex and slower. I think that needs to be spun out into a different issue.