swift-nio icon indicating copy to clipboard operation
swift-nio copied to clipboard

Replace 'R' with 'ReturnType'

Open glbrntt opened this issue 1 year ago • 4 comments

Motivation:

Single letter names are discouraged but are used in a handful of places in NIOFileSystem.

Modifications:

  • Replace 'R' with 'ReturnType' where appropriate

Result:

Clearer APIs

glbrntt avatar Apr 26 '24 10:04 glbrntt

One nit. In other places such as the NIOAsyncChannel or the NonBlockingFileIO we use Result for the generic type instead of ReturnType. If we want to be consistent across the project we should use Result.

The only public API for ReturnType was AsyncTestingEventLoop from what I found.

Not a fan of Result, too similar to Swift.Result. I picked ReturnType as Cory suggested it in the previous PR. I don't mind too much though, can change to Result if you prefer.

glbrntt avatar Apr 26 '24 13:04 glbrntt

I just wanted to point out that Result is the spelling we used most across the project. Personally I am not a fan of seeing Type in generic names. But this is not a hill I want to die on since it is barely user visible.

FranzBusch avatar Apr 26 '24 14:04 FranzBusch

One more point of reference the Mutex proposal also uses Result

  public borrowing func withLock<Result: ~Copyable, E: Error>(
    _ body: (transferring inout State) throws(E) -> transferring Result
  ) throws(E) -> transferring Result

FranzBusch avatar Apr 26 '24 14:04 FranzBusch

Sounds like you prefer Result. Will change to that.

glbrntt avatar Apr 26 '24 14:04 glbrntt

API breaks are expected

glbrntt avatar Apr 29 '24 10:04 glbrntt