News for hackers. Stuff that matters.
Re:Swift for TensorFlow Shuts Down by mrtksn on Friday February 12, 2021 @03:18PM (#26118087)
>I think Serverless would be another ideal use-case for Swift, where the productivity, clarity and correctness tools it offers would be a huge benefit.

Oh yes, I would love to have Swift framework for Firebase on server, not only for iOS. Its atrocity to write the server logic in NodeJS after making the user App in Swift.

Every time I switch from Swift to JS I deeply appreciate the beauty of Swift. On swift I do much less silly mistakes where the NodeJS code feels like up and running by some miracle and everything can collapse due to something I did but could't catch it before something horrible happens.

Re:Swift for TensorFlow Shuts Down by adevx on Friday February 12, 2021 @04:31PM (#26118783)
Could it be that you have more knowledge of Swift and don't care/want to invest in understanding Node.js/JavaScript? I really enjoy writing backend code in TypeScript for Node.js. But loath having to write Swift code for iOS. I know a big part is my unwillingness to invest time in Apple's ecosystem and properly learn Swift.
Re:Swift for TensorFlow Shuts Down by mrtksn on Friday February 12, 2021 @04:54PM (#26118995)
I used to work with web technologies but I got overwhelmed with the complexity of the tooling.

For example, TypeScript is nice but it's not a "real" language in a sense that you can write something in it and expect it to work when it's fed into the compiler or interpreter. To use it, you need to set up an environment where all the moving parts are working in harmony and the code you write in Typescript is transcribed into the actual code that NodeJS and the browser will understand and that is JS. The debugging of unusual bugs and doing something non-conventional instantly becomes multiple times harder because you have layers and layer over the actual stuff that is executed which means you loose the browsers or runtimes debug capabilities since those would rarely tell anything useful about the pre-transcription code.

Sometime you have a library where someone a few years back tried to do something similar to your idea but never had a complete solution and stopped working on it and when you try to benefit from this work to build on top of it, you find out that you need to modify you working environment to support some spacial case of legacy code. You do that and it all falls apart, now you must choose to try to fix it or give up and restore your setup. It's just horrible.

The greatest thing about working with Swift on iOS is that starting something new is as easy as creating a new Word document so you can start working on your idea right away without worrying about the tooling and see where it goes. On the JS world, I used to be exhausted and loosing all my motivation by the time I have my environment ready to go. Templates and project starters tend to be no good because they are all opinionated that you must be creating a list or a blog app. They all need extra work for a good clean start and that clean start often is too customised to be used as a general use case template.

There are so many solutions for the same problem in the Web Tech world, each comes with its own shortcomings and taht's how someone else creates the next framework. On iOS it's easy, the answer is UIKit and SwiftUI if you feel more adventurous and bleeding edge.

Re:Swift for TensorFlow Shuts Down by gurkendoktor on Saturday February 13, 2021 @06:17AM (#26122923)
I agree about TypeScript, however this paragraph also describes Swift to a T:

> Sometime you have a library where someone a few years back tried to do something similar to your idea but never had a complete solution and stopped working on it and when you try to benefit from this work to build on top of it, you find out that you need to modify you working environment to support some spacial case of legacy code. You do that and it all falls apart, now you must choose to try to fix it or give up and restore your setup. It's just horrible.

So far Swift code has not aged well, although it's gotten better during the last two years. The perpetual brokenness has moved on to Swift's tooling (binary stability, SwiftPM etc.) which wouldn't affect serverless.

Re:Swift for TensorFlow Shuts Down by hughcrt on Saturday February 13, 2021 @12:07AM (#26121555)
Deno seems to address some of the shortcomings of Node. I haven't used it on a "real" application yet, but the built in support for Typescript, formatter, linter etc. reduce the complexity of tooling, especially for server code.

But I agree, Swift is a pleasure to work with.

Re:Swift for TensorFlow Shuts Down by pjmlp on Saturday February 13, 2021 @04:35AM (#26122519)
Which is the main reason why although I like Anders's work, I keep using plain old JavaScript, hoping that one day browsers at least support WebIDL annotations natively.
Re:Swift for TensorFlow Shuts Down by ericlewis on Friday February 12, 2021 @06:42PM (#26119929)
I’ve used them all a lot and swift is certainly the easiest language out of the bunch. From a purely “safety” aspect it’s fantastic.

Ninja edit: I don’t mean easiest necessarily to learn. But easiest to use. Xcode is great.

Re:Swift for TensorFlow Shuts Down by simonbarker87 on Friday February 12, 2021 @03:23PM (#26118128)
It doesn’t solve the issue of JS but NestJS feels like a more robust way to make a server in JS - and the docs are great.
Re:Swift for TensorFlow Shuts Down by mrtksn on Friday February 12, 2021 @03:47PM (#26118368)
Thanks, I don't really need large framework for full blown app though.
Re:Swift for TensorFlow Shuts Down by jiofih on Friday February 12, 2021 @04:47PM (#26118932)
Swift and UIKit are already a much larger API than any node framework in existence.
Re:Swift for TensorFlow Shuts Down by mrtksn on Friday February 12, 2021 @05:01PM (#26119055)
They have good defaults and Xcode is a good IDE with full support of these frameworks, Swift is a good language with sensible conventions so you don't really need to learn that much.

When you don't know something you can start typing keywords and see what Xcode autocompletes for and read the explanation about that function from the documentation that is provided to you right there. It's not perfect, sometimes there's no documentation but it's not a big deal as you can look into source files or try it out to see how it behaves.

Re:Swift for TensorFlow Shuts Down by jiofih on Friday February 12, 2021 @07:56PM (#26120460)
You get the same with JavaScript if you use any mainstream editor with TS support (you don’t need to be using TS yourself).
Re:Swift for TensorFlow Shuts Down by mrtksn on Friday February 12, 2021 @08:21PM (#26120580)
I use VSCode, it’s helpful but It’s not remotely the same. With TS it’s better when the devs included documentation.
Re:Swift for TensorFlow Shuts Down by jiofih on Friday February 12, 2021 @09:02PM (#26120786)
It will use typescript type definitions when available, even if you’re writing plain JS. Auto complete works perfectly, what’s not remotely the same?
Re:Swift for TensorFlow Shuts Down by mrtksn on Saturday February 13, 2021 @02:35AM (#26122067)
It's not the same because in JS you usually would use a large number of libraries with varying degree of documentation and different conventions. Also, you would loose autocomplete when you expect to receive something as a parameter instead of defining it in that closure.

The basic language API is not that large, the benefit of autocomplete discovery comes when you have autocomplete on custom types of a specific framework accompanied with proper documentation.

Re:Swift for TensorFlow Shuts Down by jiofih on Saturday February 13, 2021 @04:21PM (#26127055)
I’m sure NestJS, which sparked this thread, has very complete type defs, as does any major framework out there.

You seem intent on dismissing something you obviously haven’t tried in the past couple years; next time I’d suggest a simple “I don’t like it” instead to save us all time.

Re:Swift for TensorFlow Shuts Down by moocowtruck on Friday February 12, 2021 @04:08PM (#26118558)
nestjs is an atrocity that should not have been wrought upon the js/ts community..
Re:Swift for TensorFlow Shuts Down by simonbarker87 on Friday February 12, 2021 @05:14PM (#26119155)
Sorry you feel that way, it feels like angular for the backend to me which is nice, it follows logical patterns, loading modules allows us to configure micro services from a single mono repo, decorators are nice, encourages use of RxJS which is great and it still allows access to the underlying express app if needs be.

Might not be to everyone’s tastes but it feels like a solid tool to me.

Re:Swift for TensorFlow Shuts Down by bartvk on Friday February 12, 2021 @04:22PM (#26118690)
Please check the guidelines via the link at the bottom. What you're doing is called shallow dismissal.
Re:Swift for TensorFlow Shuts Down by wlesieutre on Friday February 12, 2021 @03:35PM (#26118254)
Have you looked at Vapor?
Re:Swift for TensorFlow Shuts Down by mrtksn on Friday February 12, 2021 @03:37PM (#26118271)
Yep, Vapor looks nice but I want to use Firestore, so I need a reliable integration of Firestore with Vapor and there isn't one. I rely on listening for live data entries and updates on the Firestore, processing those and putting them back.

I'm doing it on NodeJS currently and I hate it. I used to like JS but Swift showed me that there's more, there's beauty in the world.

The only thing I miss on Swift is async/await and that's coming.