crystal
crystal copied to clipboard
Some `IO::FileDescriptor` methods are implemented in `Crystal::System::File`
flowchart BT
File --> IO::FileDescriptor
File --> Crystal::System::File
IO::FileDescriptor --> Crystal::System::FileDescriptor
These methods of IO::FileDescriptor
are implemented in Crystal::System::File
instead of Crystal::System::FileDescriptor
:
-
#fsync
->#system_fsync
-
#flock_shared
->#system_flock_shared
-
#flock_exclusive
->#system_flock_exclusive
-
#flock_unlock
->#system_flock_unlock
Thus it is always a compilation error to call them on IO::FileDescriptor
s that aren't File
s:
STDOUT.fsync # Error: undefined method 'system_fsync' for IO::FileDescriptor
IO.pipe[0].flock_shared # Error: undefined method 'system_flock_shared' for IO::FileDescriptor
Either the methods in IO::FileDescriptor
should be moved down to File
, or the #system_
implementations should be moved to Crystal::System::FileDescriptor
.