Live data from Hacker News

Vapor: a type-safe web framework for Swift

github.com

71–76 of 76 posts

Re: Vapor: a type-safe web framework for Swift

#71
post #43
post #12

Earlier quoted context omitted.

So took a look and turns out already happening... Aside from perfect.org there's - https://tailorframe.work - https://github.com/glock45/swifter - https://github.com/grzegorzleszek/HTTPSwiftServer - https://github.com/izqui/Taylor - https://github.com/crossroadlabs/express ...and even mor here https://github.com/search?utf8=&q=web+framework+language%3AS... > Competition is good ... except when it isn't. JavaScript fa…

The mistake most of these make is they are both web frameworks and they have their own build in web server. We should learn from mistakes in previous communities such as in Python ( https://www.python.org/dev/peps/pep-0333/#rationale-and-goal... ) and not tightly coupling these things together. A user should be free to choose their favourite web framework and then choose the best web server for their needs.

The server behind Vapor can be swapped out with any class that conforms to ServerDriver. So providers could be added to support any Swift web server.

Re: Vapor: a type-safe web framework for Swift

#72
post #2

The JSON response trick is just the right amount of magic. I'm eager to make Swift my new web dev language and this looks like a very promising option if they continue to maintain that balance.

Honest question: what's the appeal of Swift outside of iOS/OSX development? I can understand the need for an Objective-C replacement, but after more than two decades of evolution, web dev doesn't lack of good and modern languages running on top of very performant and mature platforms, with rich ecosystems. Swift brings absolutely nothing to the table.

Turn that around: lets say you know Swift because you're an iOS developer. What web dev languages or platforms can you use?

The same argument was made about Node.JS, that backend services already had great languages / platforms / ecosystems.

It's not about existing experts in the area learning a new stack, it's about enabling experts in one domain to reach 'good enough' in another rapidly.

Re: Vapor: a type-safe web framework for Swift

#73
post #27

How is this "insanely fast"? Running an example main with the route '/' mapped to return "Hello World" ab -n 10000 http://127.0.0.1:8080/ I get 1400 requests/s in debug mode and 1900 requests/s in release mode. With wrk, I actually get between 3000-4000 requests/s with default parameters. Most of the time. Sometimes it just hangs. Trying to increase the number of requests with the -r parameter made the hangs consiste…

It is perhaps not the definition of "insane" that you are looking for.

If so, one that ignores the performance of the alternatives.

Re: Vapor: a type-safe web framework for Swift

#74
post #49
post #10

Earlier quoted context omitted.

The more advanced a type system is, the more it depends on what you do with it when designing an API. A well designed API in a language with a rich, expressive type system can make higher-level guarantees. On the opposite side of the spectrum you could just use Strings for most of the types (it’s web after all!) and it would still be type safe, although the type guarantees wouldn’t be of much use.

Yes, this framework in particular doesn't demonstrate the benefits and uses of the type-safety and compile-time safety in Swift. Check out Frank ( https://github.com/nestproject/Frank#routes ) which offers type-safe and compile-time safe path routing. You define a closure to handle requests matching paths with type-safety. You are passed the correct parameter types and the correct amount of parameters directly to you…

Thanks for the clarifications. As soon as web text-based protocols were mentioned, I said "oh duh" to myself. There's nothing about the availability of a type system that forces a plain-data wrapper library to use it.

Re: Vapor: a type-safe web framework for Swift

#75
post #43

Earlier quoted context omitted.

The mistake most of these make is they are both web frameworks and they have their own build in web server. We should learn from mistakes in previous communities such as in Python ( https://www.python.org/dev/peps/pep-0333/#rationale-and-goal... ) and not tightly coupling these things together. A user should be free to choose their favourite web framework and then choose the best web server for their needs.

The server behind Vapor can be swapped out with any class that conforms to ServerDriver. So providers could be added to support any Swift web server.

I said "most", not "all" ;).

Re: Vapor: a type-safe web framework for Swift

#76
post #41
post #34

Good to see people getting serious about Swift cross platform projects. Let's hope it doesn't share the fate of Apple's Dylan projects. Been looking into this recently so leaving it here as friendly competition: https://air.mozilla.org/ur-web-a-simple-model-for-programmin...

I also really have great hopes for Swift as a modern, x-platform, general purpose, compiled language. Go is not general purpose; Rust is too low level. Haskell has a too steep learning curve. Ur/Web is really great, but not at all general purpose. Why am I hung up over "general purposeness"? Well when I learn a language, it takes quite a bit of my time; then I want to be able to apply it broadly. Therefor I shun Node…

Julia is general purpose and really fast. You can make desktop and web apps in it.
Post reply on HN