Lesson 14 (2019) discussion and wiki

Perhaps this is already addressed but I feel that Scala is also a very nicely designed language that, to my knowledge, doesn’t lack in terms of features I’ve seen so far in Swift. Is that true and if so is the choice of Swift more about JVM (as opposed to non-JVM runtimes) and compilers?

3 Likes

Naturally, it’s a very valid concern. Fortunately, because of the way protocols and extensions are defined, you can know without running the code exactly where a method is defined (be it in an extension, or a regular method, or otherwise). (Or at least the compiler can. And as a result, tools such as IDEs can tell you exactly where the implementation is, so you can figure out exactly what’s going on without running the code.)

2 Likes

I guess the Go language uses implicit conformance to interfaces. Not sure why they decided to adopt this approach. Explicit conformance seems to be more reasonable, I would say.

1 Like

FWIW, to back up what Jeremy just said, I started porting the nascent audio library to swift and was able to get it almost working in about 2 days. So it’s really quite approachable! My only warning is if it’s been a while since you learned a language besides python (or a while since you learned python) you tend to forget how frustrating it is to get error messages you’ve never seen before. That said swift’s are pretty good - once you can take a deep breath and read them instead of just panicking and feeling like an idiot!

11 Likes

Yeah, you’re exactly right. I came from Scala, and absolutely love the language. But the JVM (and garbage collection) are not appropriate for where we believe computing is going. (e.g. Our experience with GPUs, TPUs, and other hardware accelerators.)

1 Like

For those new to swift, @ste’s Tensors quick chart is really helpful.

11 Likes

Having seen him in the study group, he’s not just being humble - he really does exactly this (just like the rest of us!)

6 Likes

This page also has a short discussion and a link to a tutorial video (of mine) covering the topic of protocol-oriented programming compared to object-oriented programming: https://www.raywenderlich.com/1184-rwdevcon-2016-session-303-introduction-to-protocol-oriented-programming

10 Likes

Totally agree! Constrain yourself to be pure functional (aka DO NOT CHEAT), force your mind to think in a complete different way :wink:

To me that’s the value to learn a bit of the alien functional language named haskel

2 Likes

Named tuples are available starting python3, and are pretty useful for the reason Jeremy just mentioned (you don’t have to create a class every time).

Example (from the link):

EDIT: namedtuples have been a part of python since 2.7, thanks @mediocrates

This is a fantastic resource, @ste and @SHAR1! Thank you for sharing. :slightly_smiling_face:

Would love to help expand this into a cheatsheet (a la the #tidyverse cheatsheets: https://www.rstudio.com/resources/cheatsheets/).

4 Likes

FWIW, namedtuples exist in python 2.7 as well.

1 Like

Is the forthcoming book available in draft form for the community to read and provide comments?

I want to put this on a T-shirt. :heart:

13 Likes

What is that free book about Protocols that Chris mentioned in the slides?

Maybe Jeremy will mention it later but: as far as I understand, Jeremy is planning to do new videos to cover things he didn’t have time to do in the 8-14 lessons (like audio, image detection?).
If it’s still current, how will that work?

3 Likes

It is based on the course, so if you want to provide comments, we’re all ears :slight_smile:

Hmm, certainly happy to give feedback, but if you have a work in progress, the feedback might be more useful. Otherwise I’ll have to guess what you’ve put in the book from the lectures, notebooks, example code, forum threads, etc.

Hope object detection will also be covered

1 Like

Yes, we are still planning to have additional lectures (which will be livestreamed for you), but the exact details, including dates, have not been set yet. We will keep you posted!

39 Likes