Live data from Hacker News

Swift Algorithms

swift.org

71–80 of 80 posts

Re: Swift Algorithms

#71
post #13

Earlier quoted context omitted.

If you do that you have no soul. Why complicate it when you can just have generics that work from the get go

Because generics is a nontrivial problem to solve in languages and compilers; a really great comment that I bookmarked is here: https://news.ycombinator.com/item?id=9622417 . I read elsewhere (can't find it now) just how much lines of code and language spec is dedicated to generics in Java. Right now, the Go spec + compiler chain are a lot simpler; adding generics would have made things a ton more complicated. Second…

All I can say to that is: Taking Java and C++ to be generics as god intended is not a particularly good thing to plan around. D's generics are concise, strict, relatively simple, and mostly understandable by mere mortals (in the compiler) - this is a totally solved problem for a language like D, if Go can't do it then it's their own fault.

Re: Swift Algorithms

#72

Earlier quoted context omitted.

Kind of, but C and Python have undergone many iterations to try to become as good as they can be, while Go has lagged behind and almost prides itself on how uncomplex it is which is unfortunate only because people crave for it to be more complex. With languages like C and Python, the complexity and capability is there; it’s on you to decide when to use it. With Golang, you are just SOL.

The thing is, do you want so many iterations to get something close to being good. Or do you want people to work with the community and decide together what a feature should look like and then get it in a good shape at day 1. Like, ask any python dev what dependency management is like. That's what iteration gets you. Take your time and you get in a much better shape.

Thing is, I’m not convinced Go is actually “taking their time,” it’s just intentionally crap and there won’t be any significant improvements. Generics have been “coming” since the language became popular ~10 years ago.

Re: Swift Algorithms

#73
post #2

Worse nomenclature than any other big language I can think of, including Go and Python. Why should this package be called "algorithms"?

I agree this is a poor use of namespace. Python has that in itertools, Numpy has combinatorics and random sampling in numpy.random. Maybe they just planned to stop here? Or the algorithm namespace is bound to become overcrowded.

Re: Swift Algorithms

#74
post #25

Earlier quoted context omitted.

As an iOS engineer, I'm a bit biased, but I'd still say it's currently not practical to learn it if you're not doing Apple development. That said, I love the language, and it's a big part of what motivates me to continue being an iOS engineer (I'm not sure I'd still be at if we had kept on with Objective-C). I would love to see server-side Swift take off, but the ecosystem is still fairly new, so any large project wo…

I can't really see a reason to use Swift if you're not targeting Apple platforms. I think between Nodejs, Python, Go, (and maybe Rust), I can't really see much of a compelling usecase for Swift on the server. Even if you're developing a server component for an iOS app, I don't think it really is all that common to share a core between the two.

Swift is faster than all three of those. Vapor is now a very elegant framework, and very easy to use if you already know swift.

I agree that it’s not a language to adopt yet if you don’t also target apple platforms. Primarily I disagree with you about it not being good if you are developing a server component for an iOS app.

Re: Swift Algorithms

#75

This looks great. I'm looking forward to this and swift-numerics maturing. If you haven't seen it, check out the 2018 WWDC session "Embracing Algorithms" ( https://developer.apple.com/videos/play/wwdc2018/223/ ). It's worth watching, even if you don't work with Swift.

I'm watching the talk now, the way the speaker describes the things he does seems to me like hes making fun of the Silicon Valley type lifestyle. I think the talk is really great and funny, thank you for sharing !

He's satirizing the rigid and dismissive Gilfoyle type of person (HBO Silicon Valley character) while also exploring what app developers can learn from them.

Re: Swift Algorithms

#76
post #56

This looks great. I'm looking forward to this and swift-numerics maturing. If you haven't seen it, check out the 2018 WWDC session "Embracing Algorithms" ( https://developer.apple.com/videos/play/wwdc2018/223/ ). It's worth watching, even if you don't work with Swift.

I second that. So far every talk by Dave Abrahams has been entertaining and insightful to me.

He was also recently interviewed on a podcast here: https://swiftbysundell.com/podcast/71/.

Re: Swift Algorithms

#77
post #25
post #19

Is Swift worth learning if you're not going to be doing Apple development?

As an iOS engineer, I'm a bit biased, but I'd still say it's currently not practical to learn it if you're not doing Apple development. That said, I love the language, and it's a big part of what motivates me to continue being an iOS engineer (I'm not sure I'd still be at if we had kept on with Objective-C). I would love to see server-side Swift take off, but the ecosystem is still fairly new, so any large project wo…

iOS engineer?, what's that?

Did you pass the Fundamentals of Engineering test?, are you a member in order of you local association of engineers? do you have an official engineer seal?

If you answer no the above questions, please stop calling yourself engineer

Re: Swift Algorithms

#78
post #61
post #55

Earlier quoted context omitted.

“rust just got AVR support which I suppose swift could get pretty quickly with llvm as well” In theory, yes, but in practice I don’t see Swift going there comfortably. Its more dynamic runtime (compared to C or rust) needs more metadata, eating memory, which is precious on AVR (384 kilobytes, max, reading https://en.wikipedia.org/wiki/AVR_microcontrollers )

Just like you don't do ANSI C there, so a similar constrained version might be possible, not much different from Pascal. https://www.mikroe.com/mikropascal-avr

[deleted]

Re: Swift Algorithms

#79

Earlier quoted context omitted.

I'm watching the talk now, the way the speaker describes the things he does seems to me like hes making fun of the Silicon Valley type lifestyle. I think the talk is really great and funny, thank you for sharing !

He's satirizing the rigid and dismissive Gilfoyle type of person (HBO Silicon Valley character) while also exploring what app developers can learn from them.

Do you mean Crusty, because in my Opinion with the character he is portraying he is satirizing the typical health "crazed" silicon valley developer, is he not ?

Re: Swift Algorithms

#80
I don't understand the hype honestly. Every modern high level language should provide these algorithms. I tried Swift and it has some nice features, but i in my opinion it's not suited for system programming, because it has some very religious design desicions. For example:

- You can't use a for loop to loop over array elements by reference.

- Just look how to work with pointers in swift. There is nothing more to say about it. https://www.raywenderlich.com/7181017-unsafe-swift-using-poi...

A system programming language is a language in which you can write an memory allocator, or a function like dlopen(). While you can possibly do this in Swift, it would be much easier even in C.

I don't want to say swift is bad. The design desicions are ok for an application programming language.

Post reply on HN