A GC algorithm known since the early days of Lisp GC research and used in languages like Mesa/Cedar in the late 70's.
I can think of lots of other examples, like how VB, Delphi and C++ Builder interfaced with COM in the mid-90's.
Yes, ARC PR made automatic memory management to those without background in compiler research more easy to accept, specially if they weren't aware of the stability issues that trying to implement a tracing GC in Objective-C semantics meant.
However it goes without saying, that Lattner is really brilliant and his work on LLVM as a compiler building tool, as well as, clang in regards to improving the status quo of C static analysis tooling and compiler error messages, is really notable.
In regards to ARC, maybe also in terms of PR, as now there is a whole generation of developers that thinks reference counting isn't garbage collection.
One curious thing is how similar Swift is to modern Pascal, ie Delphi. It has many other influences, and it is certainly not Pascal with another syntax, but reading the Apple guide when Swift was released gave frequent moments of deja-vu.
On the subject of COM, yes. If you think COM means ATL you should try it in a language designed to work with interfaces and reference counting inbuilt - Delphi has COM interfaces as first-class language primitives, and a heap of classes and other code making COM quite straightforward. Much of this even spills into C++Builder, though since it's a different language it's not as clean as in Delphi. Still miles past ATL though.
Re ARC: I think the thing that makes it appealing is it's conceptually simple, completely deterministic, and can be traced by reading code rather than understanding an environment's implementation. Delphi does ARC now too, and if you've ever wanted ARC in C++, C++Builder optionally supports it for some classes. ARC is not yet on Windows for either language, we're talking just iOS, Android and soon Linux here.
(Disclosure: I recently started working at Embarcadero on C++Builder. This is a personal comment only. But liking the languages Embarcadero makes was one main reason I joined.)
Lattner is a well known expert on compilers. Having used Swift since its inception, I would call into question the reliability of the Swift LLVM compiler. In its current state (3.0.2) its absolutely terrible and does not back up the sentiment; "But fast-moving Silicon Valley needs a fundamental shift in quality standards when it comes to safety-critical software, and if you look closely, Lattner has been leading this charge at the language and compiler level".
His online presence always has that Apple Arrogance™ to it. Thats coming from someone who was born and raised an Apple fan.
So, yes I can see why one would call Lattner at the forefront of making more reliable compilers and pushing shifts in quality standards in fast-moving Silicon Valley. It is an awesome achievement to create a new language that improves both readability and safety and even more awesome to get it mainstreamed so quickly.
There are a few people who I would like to trade places with. Lattner is one of them, Musk is another. They both fulfill different parts of my long-held dreams. So I consider them to both be quite awesome. Its cool that they'll be working together too I guess.
Having used compilers for a few new languages (Rust, Go, Dart, Kotlin, Swift). Swift is the only one I've had any issues with as well as Swift seems to be the only language to have adopted the "move fast and break things" philosophy of Silicon Valley. I dunno, I just don't see the argument.
LLVM is one of the most influential pieces of software of the past decade. Hero worship isn't good but credit where credit is due.
Additionally I'm sure we can all agree there is no substitute for maturation through time and usage in the field. Which frankly is an argument for more popular languages over obscure ones. None of the ones you mentioned are ready for safety-critical system development (including Swift 3), but which one is most likely to achieve widespread adoption and field testing in the long run?
I don't think Swift stands to gain wide spread traction outside of Apple orientated app development. Aside from a lack of stability, Apple is to well known for boxing its competitors out. I've used and loved their products my entire life and I know how annoying it is to go against Apple's grain.
It already is though, there are several Linux web frameworks etc. It's open source and community run so I'm not sure how they're planning to box out competitors from it.
When writing a server, I would take Go over Swift anyday. It out preforms it, uses less memory, its simpiler, oh and it uses a "tradiontal" GC.
That is very much _not_ the case according to the testing I have done recently.
Swift uses a lot less memory than Go unless the program uses only trivial amounts of memory in the first place. Using interfaces in Go data structures makes the difference even more pronounced.
On top of that, all runtimes that use a tracing GC require tons of spare memory at all times unless programs are very carefully written to avoid memory allocation.
That said, Swift has a few very weak spots when it comes to memory. Most notably the String type, which is terrible on all counts, but that is a whole different story.
Only if the said language doesn't allow for stack or static globals.
Quite a few languages do allow it.
Not really, example in Active Oberon:
TYPE
point = RECORD x, y : INTEGER; END;
VAR
staticPoint : point; (* On the stack or global *)
gcPoint : POINTER TO point; (* GC pointer *)
noGCPoint : POINTER(UNTRACED) TO point; (* pointer not traced by the GC *)
> What particular languages are you referring to?Mesa/Cedar, Oberon, Oberon-2, Active Oberon, Component Pascal, Modula-2+, Modula-3, D, Oberon-07, Eiffel, BETA.
There are probably a few other ones.
That's fine for one point. How about N points where N varies at runtime?
If I allocate memory dynamically outside the GC's remit, I'm going to have to release that memory somehow.
On Active Oberon's case, those pointers are still safe. They can only point to valid memory regions, think of them as weak pointers that can also point to data on the stack or global memory.
This in safe code.
If the package imports SYSTEM, it becomes an unsafe package, and then just like e.g. Rust's unsafe, the rules are bended a bit and usage with SYSTEM.NEW() SYSTEM.DISPOSE() is allowed.
Just like any safe systems programming language, it is up to the programmer to ensure this pointer doesn't escape the unsafe package.
In a safe package it can only point to existing data, there isn't anything to release.
If the pointee is something that lives on the heap, it is similar to weak references. Points to GC data, but doesn't count as yet another GC root.
If the pointee is on the stack or global memory (data segment in C), then there is also nothing to release. Global memory only goes away when program dies, stack gets released on return. Memory that was allocated by the compiler due to VAR declarations, it is static.
Usually the idea is that you use untraced pointer to navigate statically allocated data structures, they are not to be exposed across modules.
My own code is unfortunately a bit messy and entangled with unrelated stuff. If I find the time I'm going to clean it up.
"The Garbage Collection Handbook", chapter 5
Garbage collectors are fully automatic and rarely if ever require to mind anything; automatic RC does almost everything but requires programmer to analyze and annotate some things as 'weak'; manual RC requires a lot more programmer's effort while still technically being "automatic"; and manual memory management means the programmer does everything.
Automatic/manual is a scale, not a boolean yes/no, and the point is that ARC lies on it a bit closer to manual than garbage collectors.
There isn't anything like ARC vs GC, that is layman knowledge and just wrong from CS point of view.
True in some sense, but mostly useless. Come on.
FWIW, as someone who was a Java programmer for over a decade before learning Objective C right after ARC came on the scene, I greatly prefer ARC over garbage collection. I find the things you have to remember to think about with both ARC and GC (e.g. circular references and unintentionally strongly reachable references) to be about the same cognitive load, but the deterministic, predictable behavior of ARC means you won't have to try to debug random GC hangs that only happen in prod under heavy load and the subsequent fiddling with a million GC options to get performance to be acceptable.
"The Garbage Collection Handbook", chapter 5
"The Garbage Collection Handbook", chapter 5
C++14 is a whole other world, and can be written with most (if not all) the safety guarantees you would expect from Swift or Rust.
I had to use it for a project and was very surprised about this too...
I used MFC like that in the late 90's/early 2000.
The problem are the team mates that write Win32/C like code, instead of MFC/C++ code.
Still, I would say it's mostly usable now. It used to be a lot worse.
-edit- I meant it as a serious question. But the person who responded to me sums up the issues.
The Swift compiler segfaults very frequently. I do find this amusing in that it's the compiler for a theoretically largely-memory-safe language (yes the compiler is written in C++, it's still funny). The syntax highlighter in Xcode, which is driven by the same stuff, also crashes, which breaks autocompletion and even indentation. Using Xcode, you just have to get used to it. It frequently reports the wrong error message - just something that isn't even close to related. Sometimes object files just become 0 bytes and you either need to clean (and experience the Swift compiler's blazing performance again) or go and modify that file so that the incremental compiler will pick it up.
I've found most of these to be triggered by using a lot of closures and possibly type inference. Shaking out the incorrect errors or segfaults is... not fun.
https://forums.developer.apple.com/thread/62737?start=0&tsta...
I should mention I also find the community to be sorta toxic. They are so focused on Swift being the one language to rule them all and they use terms like "Swifty".
https://blog.startifact.com/posts/older/what-is-pythonic.htm...
I wonder if we'll have refactoring in Xcode for C++ now Lattner has gone. I wonder why they never added it.
Not that dev'ing should rise to that level, but it isn't the typical level most developers work at. Also, if he is more of a "software correctness and reliability" guy as abalone says he is, then yes, that is the right direction.
The ability to run 32-bit applications means that preexisting libraries cannot incorporate Swift code yet.
The "application may slow down your phone" warnings that users are getting with 32-bit apps this year is a pretty strong indicator that Apple is going to remove support for running 32-bit apps completely for iOS 11 or 12. They previously had a deadline for apps to have 64-bit version submitted, but backed off the ultimatum for now.
Apps have had to support 64-bit since June 2015 (February 2015 for new apps), and Apple hasn't backed off that deadline. But there are still 32-bit apps on the store that haven't received an 64-bit update, and I don't think Apple has ever stated what it is going to do about them (other than showing the warning).
Apple can't write Swift libraries (at least not ones that are publicly exposed) until the ABI stabilizes, so that will not happen until at least Swift 4. Apple can write Swift apps as long as they don't need to support 32-bit Mac, which they haven't needed to do for years.
There is a WWDC session talking about it.
I would surprised if they actually did tho. I know someone did some static analysis of the apps for mac and iOS and found Swift was barely used at all.
I have to stomp on coreaudiod a few times a month because my USB DAC stops responding.
It is not fair to judge Lattner's ability or commitment to safety based upon Xcode and Swift. One of these predates him, the other is the result of his decisions (no doubt) but also countless decisions of others, including those above his pay grade at Apple.
Xcode is basically the evolution of something designed for NEXT. Swift is a solution to various problems in application development. I'm not aware if he (et.al.) had real time processing or safety critical devices in mind with 3.0.2.
I'm not claiming Lattner is missing some innate ability -- it just appears they're putting someone in charge who has never been exposed to this mindset. Maybe they have a culture or other leaders already in place who can foster this within the team.
> It is not fair to judge Lattner's ability or commitment to safety based upon Xcode and Swift.
To be fair, we cannot judge Lattner's ability or commitment to safety at all, because he has no publicly-known experience with safety-critical systems.
Perhaps he has relevant experience that's not public. And if it turns out he has no relevant experience, I'm not saying he can't learn. It's just strange for Tesla to put someone in charge who will be learning on the job.
http://devstreaming.apple.com/videos/wwdc/2016/507n0zrhzxdzm...
> I'm not aware if he (et.al.) had real time processing
C#? C++?
C++ has become incredibly great recently after languishing in the C++2003 period for too long.
One idea to get correcter code is clean code layout (I heard good things about the LLVM code base), simple to read code and compilers that exploit theoretical knowledge we gained over years of compiler and type theory research. I think Chris Lattner has expertise in all of them (or at least knows about their importance, contributions and drawbacks), and if want to build a full-blown self-driving car it is important to have no indeterminism in your car, and advanced languages and compilers help to guarantee specific statements about your code.
So it absolutely makes sense to invest in your compiler research team for safety, as our security, reliability and correctness expectations will rise (which is good) in particular for self-driving cars (they are not just DNNs).
That's why some of the big banks flat out refuse to implement any form of deep learning for risk analytics. They're much more reliant on simpler ML models like random forests and logistic regression that are easier to analyse and diagnose by model governance teams.
In the end you want to know what did go wrong (the public will demand it and they are right) and it might be misclassification.
But that is not enough. You want to know why did it classify situation X wrong? So the answer is because the inference network (which was created via the training network) computed its weights because the input was Y. Now you might throw your hands in the air and say "oh it's complicated, the network is undeterministic, blame NVidia", but you can also go farther and build your networks deterministic (which is possible and AFAIK not a performance penalty). Compiler research helps in at least guaranteeing that certain parts of code are deterministic which makes it easier to debug and maybe avoid complex NN misclassification scenarios, but the way to do it doesn't have to do much with NN's itself but more with language design and (real-time, in particular deterministic) OS research.
So the statement oh, that's so complex, we do not no why we misclassified is no excusion, we can do better.
For starters we have to publish NN papers with implementations that describe how to make a particular NN out of given trainigs data (provide that too). We already publish the code and network structure (see caffe, etc.), but often with pre-trained models that have been build on a cluster with many forms of training-data going through network structure, etc.
Now at the moment you read a paper, head to the published code (often the case, again a desirable property of the ML community) and try to reproduce some examples by training on the data.
However it is hard to say in the end, if your network is really as good as the published, as a simple
$ diff my-net-binary-blob.dat tesla-net-binary-blob.dat
might fail, if the stack (training etc.) to build the network is undeterministic. However if you have a good (i.e. deterministic) stack you might be able to reproduce NNs bit-for-bit, which makes it simpler to answer the question "why did we missclassify".It does make it simpler, but surely not usually simple enough to answer the question "why did we misclassify". It's like saying we will finally understand consciousness once we simulate the quantum mechanics of a certain cubic metre of space with perfect accuracy - which need not be true even if that cubic metre happens to contain a functioning brain.
One of the concepts is to prevent the use of any dynamic behavior, which means you don't need any garbage collection at all. Because garbage collection is not predictable. It can be good and bad, but even a good one is not predictable.
Embedded design and development is completely different to classical IT. For IT that sounds archaic. But it always proved right at the end.
And regarding memory allocation in reliable automotive systems: Yes, the best practice would be not to allocate at all to get to some deterministic behavior. However I've seen lots of projects where "don't allocate" is implemented as "don't allocate with malloc", and you find dozens of custom memory allocators and pools throughout the code. Some of those designs are probably less reliable and safe than using a garbage collected language would be.
It might work out with a very careful system design, but determining statically how much queued messages and memory is needed seems like a very hard task.
No garbage collection means more fragmentation though which can be an issue at some point perf-wise, there's no free lunch.
His work has been distinguished by the melding of language safety, reliability and clarity, that is, not merely having sophisticated constructs that help the guarantee correctness, but also making code simple, beautiful and easy to read. Ultimately writing safe code depends on the ability of the programmer to comprehend it, so creating a programming environment that's successful on all fronts is a foundational achievement.
A notable example: LLVM enabled ARC, a beautifully simple approach to memory management that removed much (not all) of the need for the developer to implement details in code, while providing high efficiency and, perhaps even more importantly, predictable performance (no garbage collection pauses). These are all essential for safety-critical realtime software.