1. 16

    The headline is a bit weird. The article is about “these apps are so popular, Apple went out of their way to ensure they still worked”. It’s not clear that the apps were buggy, except in the NSBundle unload case.

    1. 5

      To me it’s more accurate to say that Apple frameworks are buggy and older versions of those apps had to use workarounds and depend on the buggy behaviour until Apple decides to fix those bugs.

      I wouldn’t be surprised if Apple knew about some of the bugs from the developers of the apps during the beta period of a new OS. It doesn’t necessarily mean that Apple actively tests all of those apps as part of its OS QA routine.

      1.  

        Yeah to me the article read like “Apple consider’s these apps important enough that they go to extra lengths to ensure OS updates don’t break them”. The title here seems weirdly judgey and negative.

    1. 7

      There’s a great list of resources compiled by Steven Shaw. It’s very broad but divided into categories.

      1. 2

        That’s a great list, though now I’m definitely feeling paralyzed by choice haha

      1. 1

        I’m still betting that this will happen gradually. It makes sense to start with the smaller laptops which are already being beaten by Apple’s current ARM chips.

        1. 1

          I agree. Most ARM CPUs are not up to the challenge. The new MacBook has ARM chips, but they run the Touch Bar and a couple other functions. Not the main processor.

          1. 1

            My money is on a scaled up ARM for a super-light notebook, followed by requirements that developers start shipping LLVM bitstreams instead of fat binaries. Once that settles down it’ll go into all portables and probably a compute-add-on (or MB-only replacement model) for the 2019 Mac Pro.

          1. 3

            From my read of the Bloomberg story, there’s no indication that Apple is planning to replace all intel chips on all Macs. Just that they’ll make some macs with ARM chips, which pundits have been talking about for a while now, as if it was only a matter of time. It’s still interesting to see but I’m not sure the news are relevant to workstations with Xeon’s.

            1. 2

              This is fantastic

              1. 12

                Nested functions in Swift aren’t too modern. They were in ALGOL, Simula 67, and Pascal.

                1. 2

                  Yeah, most of these techniques would work in any modern language. I assume the target audience is recidivist C coders.

                  1. 1

                    The goal was to demonstrate how modern code, as in code you’d write today in Swift, would solve the same problems without relying on goto or multiple inheritance. I don’t claim that Swift pioneered any of this or that any of it is novel.

                  1. 14

                    I wouldn’t call defer a “very elegant solution” when RAII exists :)

                    1. 7

                      The problem for RAII is that it needs to be in a class destructor. Defer can just happen by writing a line of free code.

                      1. 7

                        Except RAII can handle the case where ownership is transferred to some other function or variable. Also, it scales well to nested resources, whereas figuring out which of any structs in a given C library require a (special) cleanup call is depends entirely on careful reading of the relevant documentation. If RAII was just about closing file handles at the end of the function, few people would care.

                        1. 2

                          Except RAII can handle the case where ownership is transferred to some other function or variable.

                          Does that matter for languages that have GC?

                          1. 7

                            RAII is not exclusive to memory management. The Resource in RAII can be aquired memory, but it can also equally be an open file-descriptor, socket or any other resource for that matter, that GC won’t collect.

                          2. 1

                            I think the ideal solution would be to be able to use class destructors for some things, but also be able to add a block to the “destruction” of a specific instance.

                        2. 3

                          Doesn’t RAII sort of hide the cleanup from your actual code? I imagine that can work only if one can trust that every library you ever use behaves well in this manner. Then again, I guess an explicitly called cleanup routine may be of poor quality as well.

                          1. 8

                            That’s the point. Cleanup is automatic, deterministic, invisible. You can’t forget it, while you definitely can forget a defer something.close().

                            Every library in Rust does behave like this, and I guess pretty much every library in C++ (that you would actually want to use) does as well.

                          2. 3

                            Excellent point! Now it feels only slightly more elegant than goto :)

                          1. 4
                            • CompilerKit is a Swift library of data structures and algorithms used in compilers. It’s my learning project.

                            • Applying to OMSCS. I really hope they’ll take me without an undergrad in CS. Any advice/help is very welcome and greatly appreciated.

                            1. 5

                              Applying to OMSCS. I really hope they’ll take me without an undergrad in CS. Any advice/help is very welcome and greatly appreciated.

                              Tbh your CV looks great, from what’s on your website at least. STEM degree, published papers, shipped apps. The only thing I could see is if they’re really strict on preferring a bachelor’s in “CS or a related field”, which they list as CS/math/EE. Maybe try to make sure at least one of your rec-letter writers can emphasize that you have a solid close-enough background, specifically if they can speak to: 1) that your educational background, while not CS, includes solid STEM fundamentals, and 2) your practical programming skills.

                            1. 10

                              All good reasons, IMO. But it fails to mention any of the well-known problems with C, which would have prevented many vulnerabilities in SQLite. So it reads like they’re just trying to justify their choice, rather than an honest assessment of C. I don’t know what the intention or purpose of this page is, though. And to be fair, I would probably have made the same choice in 2000.

                              1. 40

                                I don’t know what the intention or purpose of this page is

                                Probably to stop people asking why it’s not written in Rust.

                                1. 14

                                  Since it mentions Java but not Go or Rust, I suspect it’s an older page.

                                  1. 25

                                    That’s the beauty of C, it refutes all future languages without having to be recompiled.

                                    1. 1

                                      It mentions Swift, too.

                                        1. 1

                                          Yeah, looking at the parent page, it appears it showed up sometime in 2017. I was mislead by the mention of Java as an alternative, because I think it’s rather obviously unsuited for this job.

                                    2. 4

                                      I tried finding a list of vulnerabilities in SQLite and only this page gave current info. Now, I’m unfamiliar with CVE stats so I don’t know if 15 CVE’s in 8 years is more than average for a project with the codebase and use of SQLite.

                                      1. 7

                                        […] I don’t know if 15 CVE’s in 8 years is more than average for a project with the codebase and use of SQLite.

                                        I don’t know either! I looked at the same page before writing my comment, and found plenty of things that don’t happen in memory-safe languages. There were fewer entries than I expected, but also some of them have descriptions like “Multiple buffer overflows […],” so the number of severe bugs seems to be higher than the number of CVEs.

                                        1. 7

                                          The 4 in 2009 appear to have been in some web app that used SQLite, not SQLite itself.

                                          1. 4

                                            The security community generally considers CVE counts a bad mechanism to argue about the security of a project, for the following reasons:

                                            Security research (and thus vulnerability discovery) are driven by incentives like popularity, impact and monetary gain. This makes some software more attractive to attack, which increases the amount of bugs discovered, regardless of the security properties of the codebase. It’s also hard to find another project to compare with.

                                            (But if I were to join this game, I’d say 15 in 8 years is not a lot ;))

                                          2. 1

                                            15 vulnerabilities of various levels in the past 10 years.

                                            https://www.cvedetails.com/vendor/9237/Sqlite.html

                                            How does that compare to other products or even similar complicated libraries?

                                          1. 16

                                            I fucking hate reCaptcha, partly because the problems seem to be getting harder over time. Sometimes I literally can’t spot the cars in all the tiles.

                                            1. 19

                                              It’s also very effective at keeping Tor out. ReCATPCHA will, more often than not, refuse to even serve a CAPTCHA (or serve an unsolveable one) to Tor users. Then remember that a lot of websites are behind CloudFlare and CloudFlare uses ReCAPTCHA to check users.

                                              Oops.

                                              1. 2

                                                For the Cloudflare issue you can install Cloudflare’s Privacy Pass extension that maintains anonymity, but still greatly reduces or removes the amount of reCaptchas Cloudflare shows you if you’re coming from an IP with bad reputation, such as a lot of the Tor exit nodes.

                                                (Disclaimer: I work at Cloudflare but in an unrelated department)

                                                1. 2

                                                  Luckily, CloudFlare makes it easy for site owners to whitelist Tor so Tor users don’t get checked.

                                                  1. 9

                                                    Realistically, how many site owners do that, though?

                                                2. 16

                                                  I don’t hate it because it’s hard. I hate it because I think Google lost its moral compass. So, the last thing that I want to do is to be a free annotator for their ML efforts. Unfortunately, I have to be a free annotator anyway, because some non-Google sites use reCaptcha.

                                                  1. 7

                                                    Indeed, also annoying is you have to guess at what the stupid thing is trying to indicate as “cars”. Is it a full image of the car or not? Does the “car” span multiple tiles? Is it obscured in one tile and not in another? Which of those “count” if so? Should I include all the tiles if say the front bumper is in one tile or not? (my experiments have indicated not).

                                                    Or the store fronts, some don’t have any signage, they could be store fronts, or not, literally unknowable by a human or an AI with that limited of information.

                                                    I’m sick of being used as a training set for AI data, this is even more annoying than trying to guess if the text in question was using Fraktur and the ligature in question is what google thinks is an f, or an s. I love getting told I’m wrong by a majority of people not being able to read Fraktur and distinguish an f from an s from say an italic i or l. Now I get to be told I can’t distinguish a “car” by an image training algorithm.

                                                    1. 4

                                                      At some point, only machines will be able to spot the cars.

                                                    1. 10

                                                      I work in the info sec field and honestly I’d repremand an employee for not investigating an annomoly on the network. Unless the cluster is for testing purposes and the employee’s title contains the word “scientist” they shouldn’t be running their own ad-hoc tests. The fact that they believe their biggest mistake was telling their boss makes me cringe too. IMHO this is one whiny worker and I’d recommend getting rid of them.

                                                      1. 14

                                                        IMHO this is one whiny worker and I’d recommend getting rid of them.

                                                        And you’d lose a great deal of expertise, if you were familiar with the author’s work and past writing. :)

                                                        People stuck working under bozos develop certain pathologies, and it takes solid leadership to build trust and correct those pathologies.

                                                        1. 6

                                                          I have read a bit of the author’s other work and it’s largely filled with the same “everyone doesn’t work as hard as me!” rhetoric. Just because someone writes about how they’re the only one who does anything doesn’t mean it’s true.

                                                          1. 9

                                                            Sure, but it doesn’t also mean it’s false either.

                                                            It’s entirely possible (given their employment history) that they actually ended up in dysfunctional orgs and units.

                                                            1. 2

                                                              That’s a good point, but there is also the flip side: they’re a dysfunctional problem worker.

                                                            2. 9

                                                              Some people are competent but grind up against incompetent orgs. Some people are incompetent and eventually flushed out of competent orgs. They tell similar stories. I was right and everyone was wrong. There’s usually a tell or two that reveals which it is though.

                                                              1. 7

                                                                I seriously don’t understand why there’s a question about this. I too have concerns about this post, but reading past posts it seems blindingly obvious that Rachel Kroll is competent and knowledgeable. Regardless of what you think of her personality.

                                                                /cc @friendlysock and @tedu. Yes, in general it can be this or it can be that. But in this instance is there really any doubt?

                                                              2. 2

                                                                I think this post is more illustrative of her poor leadership skills than of her good technical skills. Furtheremore, she doesn’t seem to be aware of that aspect of it at all. She seems genuinely surprised that her bahaviour was not welcome by everyone in management.

                                                              3. 7

                                                                What about all the other people who didn’t even spot the anomaly because they weren’t trying?

                                                                1. 22

                                                                  It’s the author’s opinion that others weren’t working as hard so I will take that assessment with a grain of salt. I don’t think it’s an individual’s prerogative to make work traps for other employees so they can be shown as “not working that hard”. If you’re really concerned about the performance of others then have an honest discussion with your manager about it, don’t try to measure others with a metric of your choosing.

                                                                  1. 5

                                                                    If the anomaly persists for two months without anyone seeming to notice, is it really a problem? If it is causing a problem, that suggests that key metrics aren’t being observed - a problem exists but nobody knows - in which case you’ve got a bigger problem!

                                                                    1. 4

                                                                      What about them? Were they even supposed to be trying? If the author always fixes the problem, like she claims, it seems possible that other people on the team may have thought it was her responsibility.

                                                                      In any case, when she saw the problem she should have told her boss and said something like, “I see there’s a cluster with an extra node, but I don’t have time to fix it myself right now, can you have somebody else investigate?”

                                                                      1. 5

                                                                        Yeah, they’re supposed to be trying.

                                                                        There was no division of duties on the team. Everyone was responsible for the system as a whole.

                                                                        If I leave my trash next to your desk every day, and you always throw it out for me, are you the one littering when a soda can doesn’t get picked up? Am I even supposed to be trying, once I become dependent on you doing my job for me?

                                                                  1. 4

                                                                    Love the book! I ported the tree-walking interpreter to Swift and wrote a little bit on how it compared to the Java version in the README.

                                                                    I’m doing the same with the bytecode/VM interpreter. Will be interesting to see how far I can get with Swift without resorting to any unsafe pointer manipulation and how the performance will compare.

                                                                    1. 1

                                                                      Awesome! I love seeing how the code maps to other languages. I think Swift is surprisingly well-suited for language stuff with it’s nice ML-like enums.

                                                                    1. 2

                                                                      Learning is a very good reason to do this.

                                                                      1. 1

                                                                        Great setup, thank you for sharing it. I like the transparency of it. I’m currently using dokku, but it keeps evolving in ways I don’t understand very well.

                                                                        1. 2

                                                                          Great to hear! I’m going to write more detailed notes and instructions soon(ish), maybe those will inspire you to try it out.

                                                                        1. 3

                                                                          Basically, they make developer tools and a programming language is the ultimate lock-in in that market.

                                                                          I don’t buy the argument that languages are complementary to IDEs. People don’t pay directly for languages. They pay for services around the language, which is what JetBrains sells already. OTOH, hardware and OS are complementary products. If people are tempted to switch to Macs and develop using Swift instead of Java, that might take some money away from IDE vendors. Notice how Apples gives you a “free” IDE and are pushing Swift on the server.

                                                                          He argues that developers might think Kotlin is beneficial but JetBrains are smarter than that. But I think from JetBrains point of view, it doesn’t matter if Kotlin (or its competetirors) have real advantages over Java or not. All it matters is what their customers think.

                                                                          So, yes, they were worried that their IDE business will go down the drain if everyone switches away from Java. They realized how vulnerable they are to shifts in programming language popularity. Their options were:

                                                                          1. Bet on one of the existing languages and be at the mercy of a young and small player
                                                                          2. Support all of the languages and remove your dependency on a specific language (which they might eventually chose to do)
                                                                          3. Create your own language and try to have more control over your destiny (which is what they did)
                                                                          1. 1

                                                                            They have been doing number 2 for basically half a decade already. There is pretty much no popular language they don’t support: C, C++, C#, F#, Groovy, Go, Java, JavaScript, Objective-C, PHP, Python, Ruby, Rust, Scala, SQL, TypeScript, VisualBasic, … plus dozens of language plugins made by language communities.

                                                                            1. 1

                                                                              Different languages need different approaches, but Idea is initially designed for Java. It will work for similar languages (C#), but its killer feature — autocomplete after typing . — will not work for most dynamic languages (js, python, ruby). I tried PyCharm and it works mostly like dumb editor (autocomplete sometimes works but very unreliably), but was quite slow for dumb editor (recent versions are probably much faster, especially compared to Electron-based IDEs).

                                                                              That’s also the reason why Microsoft created Typescript — not for type checker to catch your bugs, but for autocomplete in Visual Studio. Jetbrains designed Kotlin to be statically analyzable.

                                                                              Many other languages are not especially statically analyzable but there are opportunities for other IDE features for them. For example, Java completely lacks repl, but for Clojure repl is killer feature. It’s very convenient to write code while editor is connected to instance of program and being able to update its code on the fly and evaluate expressions. Cider, an emacs tooling for Clojure, even has autocomplete based on runtime information from live process, as opposed to static analysis of source code. Smalltalk IDEs use both static analysis and runtime information AFAIK (I don’t know details).

                                                                              And only Java (maybe C++ too) needs “code generation” feature (i.e. creation of getters, setters and hashCode).

                                                                              So, properly supporting multiple languages might be hard. One-size-fits-all approach might be “support java-like languages fully but only syntax highlighting for others”. Microsoft created Language Server Protocol which is cool, but again it’s designed for Java-like languages (C#, Typescript).

                                                                          1. 3

                                                                            I’m reading “I am a Strange Loop” by Douglas Hofstadter. I’ve always been interested in how mind and consciousness can emerge from an almost binary neuronal firings in the brain. The books answer is that it happens through self-referential structures and recursion. The author also wrote the famous “Gödel, Escher, Bach” (aka GEB), which I haven’t read.

                                                                            1. 4

                                                                              I’m trying to port the Swift parser from C++ to Swift and have been loving it so far.

                                                                              1. 1

                                                                                Interesting, does Swift have safety guarantees, or is it “much more likely to be safe” like Go or C++?

                                                                                1. 3

                                                                                  Swift is basically an ML variant, but has some backwards-compatibility stuff and some auto-unwrapping of optionals syntax that may decrease safety vs, say, SML. YMMV

                                                                                  1. 1

                                                                                    What safety guarantees exactly do you have in mind?

                                                                                    1. 5

                                                                                      I should have said memory safety: http://www.pl-enthusiast.net/2014/07/21/memory-safety/

                                                                                      Parsers in C are notorious for having memory safety issues. It’s basically guaranteed that any sufficiently complicated parser in C will have memory safety problems.

                                                                                      Here’s one I found in Brian Kernighan’s awk:

                                                                                      https://github.com/andychu/bwk/blob/master/test-results/asan.log

                                                                                      Java and Python are safe. C++ is not but it helps you more than C. Go helps you too, but I’m pretty sure there are some memory safety issues. So I was wondering where Swift stands.

                                                                                      EDIT: some info about Go and memory safety: https://insanitybit.github.io/2016/12/28/golang-and-rustlang-memory-safety

                                                                                      1. 3

                                                                                        Given this definition Java is also memory unsafe - you can crash jvm with data race. Since this is crash and not unhandled null pointer exception I would assume that given enough time it’s possible to exploit that in more interesting ways.

                                                                                        1. 2

                                                                                          It’s not fully safe because they still want to allow you to be able to do some fringe stuff but the main path and idiomatic code is memory safe by default using constructs like if let the_variable = some_optional {/*use the unwrapped the_variable here*/}

                                                                                          you can force memory unsafe by force unwrapping it with ! like let somevariable = some_optional_returning_function()! but that can crash if some_optional_returning_func is null.

                                                                                          1. 1

                                                                                            Isn’t that basically fromJust with an unfortunately convenient syntax?

                                                                                            1. 1

                                                                                              I don’t believe so. fromJust looks like it throws an error if the maybe item is nothing(i only played around with haskell years ago and i am no expert on it though). the if let ... { pattern is used all the time as a guard on values. you can also chain the if let values together to get one block with all the values you need guaranteed to be non null.

                                                                                              like

                                                                                              if let x = y,
                                                                                                 let z = x.something(),
                                                                                                 let w = someRandomoptional(),
                                                                                                 let stringrep = w as String? {
                                                                                              // only called if all the values above are non-null. 
                                                                                              // guard statements are useful too and are put at the top of the function 
                                                                                              // to early exit if the function can't deal with the null values. 
                                                                                              print(x)
                                                                                              print(z)
                                                                                              print(w)
                                                                                              //...
                                                                                              }
                                                                                              

                                                                                              This is a conditional binding for the duration of the scope of the block. the nullability of objects in swift are very important. you can also call items conditionally too.

                                                                                              let foo = bar() // bar returns an optional object
                                                                                              foo?.setVal("xyz") // will not crash if foo is nil.
                                                                                              // syntactic sugar for
                                                                                              if foo {
                                                                                              foo.setVal("xyz") 
                                                                                              }
                                                                                              
                                                                                              1. 1

                                                                                                Sorry, I should have quoted the part I was referring to:

                                                                                                let somevariable = some_optional_returning_function()!

                                                                                                The force unwrapping operator ! will crash if the value if nil, similar to how fromJust crashes on None.

                                                                                                1. 1

                                                                                                  Gotcha. yeah that’s basically fromJust but more convenient.

                                                                                            2. 1

                                                                                              If it crashes on null, then that’s considered memory safe behavior. C is unsafe because dereferencing null is undefined. The program can use the value at address zero, or anything else.

                                                                                              I googled and found this:

                                                                                              https://developer.apple.com/swift/blog/?id=28

                                                                                              A primary focus when designing Swift was improving the memory safety of the programming model. There are a lot of aspects of memory safety

                                                                                              So my takeaway that it’s like Go or C++ – more likely to be safe but not guaranteed like Java or Python.

                                                                                              1. 1

                                                                                                Yes, it’s technically possible to use pointers and Swift is in fact fully interoperable with C, but it is not the path of least resistance. A pointer and its related operations are encapsulated in a struct of the type UnsafeMutablePointer, where:

                                                                                                You are responsible for handling the life cycle of any memory you work with through unsafe pointers to avoid leaks or undefined behavior.

                                                                                                To address your first comment, I didn’t use any of those unsafe pointers in the implementation I’m writing in Swift while the original C++ parser is a jumble of moving pointers, so yes I expect the Swift version to be safer.

                                                                                                1. 1

                                                                                                  As a default the swift compiler will not let you do bad things unless you ask to.

                                                                                                  you can declare things as explicitly unwrapped from optional sources. so something like a link to an object in a window would be typically explicitly unwrapped which means that you are guaranteeing that the value will never be null and you are smarter than the compiler. (if the value of a linked storyboard component was ever null it would be a problem) another time they are used if you are sure that the value of it will not be null before using it but you don’t want to set the value of it at initialization.

                                                                                                  They designed swift so you can do anything that c can do including bit tweaks and pointer wrangling but it’s a much, much safer paradigm where you do have to go off the rails and make explicit choices to subvert your application. It does make parsing json data more annoying but more safe.

                                                                                          2. 1

                                                                                            it depends on what you mean. Their philosophy is to deliberate and make a decision on each potential safety issue that achieves a good balance between performance, convenience and safety.

                                                                                            E.g., it forces you to handle all potential nils explicitly in your code but it doesn’t do anything about array access at compile time. But if you go out of bounds your program will crash (I think it does bounds checking at runtime and deliberately crashes it to avoid undefined behaviour).

                                                                                            1. 1

                                                                                              Sorry I should have said memory safety (see sibling comment). As long as it crashes on null pointers and OOB, that is memory safe. Whereas a C program can just keep going and do whatever.

                                                                                        1. 3

                                                                                          Reminds me of the recent Noam Chomsky talk at Google

                                                                                          Why not do some of the serious things?

                                                                                          1. 1

                                                                                            Another happy Fastmail user. It even supports push email on the default iOS mail app, if that’s what you’re using. Junk filtering wasn’t great initially but it quickly caught it to what I had before after a few weeks of using their spam training system.

                                                                                            1. 2

                                                                                              I continue working on my Swift port of the Lox interpreter. Original interpreter is written in Java. In my project, I try to go beyond making a straight port to exploring ways in which I could take advantage of Swift’s features to improve the design of the interpreter. I’m documenting the lessons I learned in the readme as I go. The project has helped me get a great appreciation for Swift (and interpreters).

                                                                                              The Lox interpreter is written in Java as a demo accompanying the book, Crafting Interpreters by Bob Nystrom. Bob is publishing the book one chapter at a time as he completes them.