WhileyCompiler
WhileyCompiler copied to clipboard
Std Native Method Implementations
Need to figure this out in conjunction with the standard library.
One problem here is how to represent File. Some points:
- (Rust / C) The obvious choice is to represent
Fileas a fixed-width record. This follows Rust, whereFileis astructalbeit with hidden fields. - (JVM) The above choice is difficult (impossible?) on the JVM because you must represent it as an object, such as
FileDescriptororRandomAccessFileor similar. These don't exist in Whiley, so you're forced to hide them in an open record.
Not sure how to reconcile this. One possibility is perhaps to allow for a native type fd which is hidden from the user. Then, on C/Rust platforms this is just a uint whilst on Java it is something else altogether.
Yet another approach on the JVM is to add a second level of indirection. Basically, an array of FileDescriptor objects which can be indexed into. I suppose that would work at least.