[swift-server-dev] Next HTTP API meeting

Helge Heß me at helgehess.eu
Thu Mar 30 09:43:05 CDT 2017


On 30 Mar 2017, at 16:28, Johannes Weiß <johannesweiss at apple.com> wrote:
> I meant trivial as in easy to create once, not in easy to create the code. A function
> 
> func synchronise<T>(_ func: ((T) -> Void) -> Void) -> T
> 
> which is easy to write might help though.

Well, yes, this is easy exactly the other way around :-) I’ve done this:

  https://github.com/NozeIO/Noze.io/blob/master/Sources/fs/Directory.swift#L12

  public func readdir(_ path: String, cb: @escaping ( [ String ]? ) -> Void) {
    module.Q.evalAsync(readdirSync, path, cb)
  }
  public func readdirSync(_ path: String) -> [ String ]? { .. }

I’d claim the reverse, it is often easier to go from sync to async. Dispatching on a GCD queue is trivial :-)


> AFAIK, libmill and friends all use setjmp/longjmp which is unsupported in Swift anyway and might/will break

OK, lets assume that the Go approach won’t be supported (or pure synchronous IO like in Apache). This still leaves us with alternative async I/O frameworks. E.g. I’d potentially like to use libuv in Noze.io and replace GCD channels with that. Or do you want to standardise this effort on GCD?

hh

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.swift.org/pipermail/swift-server-dev/attachments/20170330/32bda725/attachment.sig>


More information about the swift-server-dev mailing list