Am I the only one as a JS dev, who find it hard with types & casting in Swift?
Swift Programming Language Evolution
41–50 of 181 posts
Re: Swift Programming Language Evolution
#42Earlier quoted context omitted.
Lots of languages ARE faster than C, including older languages than C, like Fortran and Forth. Being faster than C is not anything special in itself. Most things being equal (typed, optimized, compiled, no runtime etc) C is mostly faster when it does something with a lower overhead than some other language (e.g. a specially written hashmap algorithm targeted to some program vs C++ std map type), not because of its pr…
Fortran especially. Forth seems to depend on processor characteristics. I seem to remember that Ada compilers routinely produce faster code than C compilers.
Re: Swift Programming Language Evolution
#43Re: Swift Programming Language Evolution
#44Re: Swift Programming Language Evolution
#45So Swift has been out awhile, what do people think of it? What other language would you compare it to (e.g. C#, C, C++, etc)? What about the libraries are they well laid out?
Example: https://youtu.be/mgpAmqdiPKE
Re: Swift Programming Language Evolution
#46So Swift has been out awhile, what do people think of it? What other language would you compare it to (e.g. C#, C, C++, etc)? What about the libraries are they well laid out?
I've been playing around with it a little and it's... fine? Very capable. Not run into any moments that have blown my mind, but neither have I found any that disgusted me. In a weird way it actually reminds me most of TypeScript - JavaScript-y, but with types and stronger enforcement of rules.
Re: Swift Programming Language Evolution
#47Re: Swift Programming Language Evolution
#48Earlier quoted context omitted.
Me too. Is something similar available in Rust? I'm familiar with smart pointers in C++ but I love that Swift manages a lot of that mess for me.
Generally data lifetime in rust is fully deterministic and the borrow checker can statically determine when data should be deallocated. If for whatever reason you do need reference counted semantics there are options in the stdlib (alloc::rc).
Automatic reference counting inserts all of the refcount bumps. In Rust, you have to write the up count yourself, but not the downcount.
But, reference counting isn't used very often, at least in my experience. It's very useful when you have non-scoped threads, though.
Re: Swift Programming Language Evolution
#49The removal of prefix and postfix ++ and -- operators and the removal of C-style for loops are mistakes, IMO.
Re: Swift Programming Language Evolution
#50Earlier quoted context omitted.
Do you have a link to some benchmarks at hand? Your "possibly faster than C" claim sounds too good to be true without a source, but I'd very much like to be proven wrong :)
By http://benchmarksgame.alioth.debian.org/u64q/which-programs-... Swift's performance is similar to Java's, but quite a bit faster when working with many objects: http://benchmarksgame.alioth.debian.org/u64q/swift.html On a few benchmarks it's faster than C as well: http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan... though not most. I suppose they were able to do the binary-tree benchmark so much better…
… because it's faster to use a memory pool than GC for that … ditto C Rust Ada Fortran C++ …
http://benchmarksgame.alioth.debian.org/u64q/performance.php...