Live data from Hacker News

Vapor: a type-safe web framework for Swift

github.com

41–50 of 76 posts

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

#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.js, Go and Erlang/Elixir.

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

#42
post #28

I suppose most who do Swift at the moment also use it on front-end, since this advertises being "type-safe" what is their preferred method to connect to this JSON server from the Swift front-end in type safe manner? Also, the Fluent is clearly not type-safe, it's stringly typed ORM to database. Since many backends are just fancy wrappers to database, this part should be most important for type-safety. It's nowhere as…

> I suppose most who do Swift at the moment also use it on front-end

Given that it's primarily used for iOS and Mac OS X programming, yeah, of course. Both the GUI and app logic are typically coded in Swift.

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

#43
post #12
post #7

Earlier quoted context omitted.

Competition is good. Two frameworks doesn't mean there'll be an explosion.

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.

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

#45
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…

Ur/Web is for web and thus not general purpose. I can't say if Ur (without web) is fit for general purpose use.

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

#46
post #40
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...

Why would you compare it to Dylan? Swift will be the most popular iOS language within 18 months. If you look at the new iOS books that are released, most use Swift. I count over 3 dozen books within 18 months of Swift's release: http://www.h4labs.com/dev/ios/books

[deleted]

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

#47
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…

> Go is not general purpose

Can you explain?

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

#48
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…

How is Go not general purpose?

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

#49
post #10

I'll admit my total naivete up front: isn't Swift already a typed language? Is there something about being a web framework that necessitates some other kind of type safety?

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 your closure. This gives you compile type safety.

    // Handle GET requests to path /users/{username}
    get("users", *) { (request, username: String) in
      return "Hello \(username)"
    }
In contrast, without this compile-time safety you will most likely be passed an array of Strings and you will have to pull items out.

    Route.get("users/:username") { request in
      if let username = request.parameters["username"] {
        // Return something with username
      } else {
        // TODO Return 404
      }
    }
Here you have to manually validate these parameters, there is also the lack of compile time safety in the way you are writing a hard-coded string for each parameters. There is a string "username" twice, both the path and when you pull out the parameter from the array. There is a large room for user error or typos here.

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

#50

It's weird how little qualifies for 'type-safe' nowadays. The templating language is not typesafe for example. The parameters in the request aren't either. Take a look at http://haskell-servant.github.io/ if you want to see what type-safe means.

Indeed, i don't see anything about it that's particularly type-safe, and the claim is not discussed beyond the bullet point at the top.
Post reply on HN