News for hackers. Stuff that matters.
Re:Swift System Is Now Open Source by amelius on Friday September 25, 2020 @05:08PM (#24594110)
> but Swift for Tensorflow[0] is exciting and could become a refreshing alternative to python for machine learning

I prefer the landscape for ML not to be fragmented based on non-essential qualities like the language that is used.

How great is it that researchers publish code in the same language, and everybody can use that code immediately without having to learn language X and/or porting the implementation?

Re:Swift System Is Now Open Source by skohan on Saturday September 26, 2020 @02:19AM (#24596808)
My problem with Python is that once you start working with a strongly-typed language, a duck-typed interpreted language starts to feel like it's missing a major tool in terms of writing correct code.

I also think S4TF's approach has been really neat here: there's a really nice python interop so you still have access to the entire body of work and tools in python available, and it basically feels like writing native swift code.

Re:Swift System Is Now Open Source by formerly_proven on Saturday September 26, 2020 @05:18AM (#24597470)
> My problem with Python is that once you start working with a strongly-typed language, a duck-typed interpreted language starts to feel like it's missing a major tool in terms of writing correct code.

I primarily write C++ and Python and never feel like this.

Re:Swift System Is Now Open Source by skohan on Saturday September 26, 2020 @06:10AM (#24597660)
Not all type systems are created equal. Swift's is powerful and expressive
Re:Swift System Is Now Open Source by amelius on Saturday September 26, 2020 @07:21AM (#24597944)
You could at least explain what features set it apart, in your opinion, from other type systems and why they are important in this case ...
Re:Swift System Is Now Open Source by skohan on Saturday September 26, 2020 @09:02AM (#24598489)
Well a good example would be the 1st class optional handling in Swift - Swift's type system gives you explicit tools which make it possible to guarantee you won't have an NPE at runtime, as long as you write idiomatic Swift. This is a whole class of errors which are systematically avoidable in Swift (and other languages, like Rust), but take special care to avoid in c++ or python. So with Swift you get this "if it compiles it runs" experience, which is a difference you would not feel between c++ and python.

But in general, c++ to python is an awkward comparison because c++ is extremely low-level by comparison. So you do get static typing, which is nice, but you also get a lot of other issues to deal with - namely manual memory management - so with either python or c++ you have a high probability you will have code which fails at runtime. It would just be the case that in c++ most of the time it would be because you handled memory incorrectly, whereas with python it would more often be because you made a type-related error. Swift is much more comparable with Python in terms of reducing cognitive load by obviating low-level details from the programmer.

Re:Swift System Is Now Open Source by auggierose on Saturday September 26, 2020 @07:06AM (#24597889)
Yeah, C++ is not a language with a proper type system. Swift is.