myst-lang / myst

A structured, dynamic, general-purpose language.
http://myst-lang.org
MIT License
118 stars 17 forks source link

Implement remaining `File` methods. #177

Closed faultyserver closed 6 years ago

faultyserver commented 6 years ago

This PR implements a majority of the File API exposed by Crystal. To do this cleanly, it also introduces a new NativeLib.passthrough macro that should help write native bindings more easily and consistently.

Some methods have issues with this process that lead to them needing special treatment. They are marked with TODO comments describing the bugs.

An overview of what's been added:

All of these are static methods on File. Notably left out of these additions are the stat methods, as they return a Stat object and would need to be transformed into some other Myst object before being returned to the caller. This may be done in the future, but is not needed as of now.

I'll also admit that the testing for these methods is lacking. Most of this is because the methods are direct passthroughs and thus testing them would be repeating the testing done by Crystal itself. However, adding tests for edge cases and argument validity would still be beneficial.