text stringlengths 0 2.35k |
|---|
And a corollary to that is the Rice theorem, which says that you can't prove any interesting property (as in non-trivial) about a program. So you have this strong theoretical basis that says you can't do that, and yet you have this rich scientific field where we do that every day. It's not a problem, it just turns out ... |
**Mat Ryer:** Reflection. |
**Matan Peled:** Reflection, yeah. If you have enough reflection, if you do enough pointer tricks in C, you can always confuse it enough that it doesn't work. But that's fine, because for 90% of the programs it does work, and that's usually good enough. We're talking about static analysis, not verification. |
**Natalie Pistunovich:** And how does this field tie to your research? Or what is your research about? |
**Matan Peled:** So what I want to do in my Ph.D. is meta programming using static analysis. And when I say meta programming, what I mean is code that writes code, or code that changes code, so basically refactoring. Refactoring usually means that you change the code and then you work on that changed version, but you c... |
And what I think is that basically making them aware, having them use static analysis information can make them more powerful, more efficient. So I can for example say -- one of my initial examples was making reactive programming. Let's say I have this class, and in this class there is a field, and it has a getter, and... |
\[20:15\] So if you can do static analysis and modify the program based on that, then you can easily do that. And that's basically my goal - I want to enable things like that, and I want to make in (let's call it) a declarative way, that I can build using basic building blocks more complex behavior. |
**Mat Ryer:** It sounds really interesting. One example of static analysis I've seen - because you've mentioned quite a few... And I actually hadn't considered even like formatting as one of those. But of course, it makes sense. One of the downsides to the format go fmt tool is if the program is incorrect, it doesn't w... |
**Matan Peled:** Well formed. |
**Mat Ryer:** Yes, thank you. It has to be well-formed. So any kind of static analysis that can happen without that being the case, I find that to be quite amazing... Because often it relies on the same kind of packages that analyze the program for compilation to do static analysis. Is that right? |
**Matan Peled:** Definitely. So handling things that are partly correct, or are partly complete even - like, they're not incorrect, they're just missing a bit and you want to take just the parts that are there that are good, is hard. |
One of the other projects that I'm currently working on - it has to do with pseudo-code. So what we want to do is to compare pseudo-code to actual code and see if they match. That's kind of a similar idea, because pseudo-code obviously doesn't have perfect syntax. |
**Mat Ryer:** I use occasionally GitHub Copilot, and that actually does quite an interesting job... The code can be wrong. In fact, you can give it context just by writing comments, or just by the names of the functions that you use, and the variable names, and things. So that definitely feels magic. I guess that's dif... |
**Matan Peled:** Yeah. So ML for PL or however you wanna call applying machine learning to code - it's interesting, because on the one hand, code... So a lot of the techniques that are used there come from NLP, from natural language processing, which obviously makes sense, because this is text, and this is text, and yo... |
**Mat Ryer:** Right. |
**Matan Peled:** But on the other hand, code is very structured, it's very hierarchical, it has properties... In order to compile, it has to be very strict in various ways. So giving up all that information, all that context is silly. You do wanna use it, and the (let's call it) non-machine learning approach to static ... |
I don't understand 100% how Copilot works. I've read their white paper, it's very interesting... I don't think that the -- on the one hand, one of the points of machine learning is that they don't do anything specific, they don't say "Oh look, there's a type." They want the machine learning to somehow learn that themse... |
**Mat Ryer:** Yeah. |
**Matan Peled:** ...but on the other hand, I think that they do try very hard to make sure that the algorithm has access to type information, and things like that. |
**Mat Ryer:** Yeah, it's funny, because it gets things right that are really surprising, and it makes mistakes that a simple static analysis tool wouldn't make. It still does make those mistakes, and I'm sure they'll keep working on that. It's almost like there'll be another extra check after to see whether this even i... |
\[24:06\] It does get frustrating sometimes, because it'll kind of guess arguments to a method that are wrong. They look like it's the thing it's seen before, but they aren't the arguments for that particular method... So just a quick check would have found out that that wasn't gonna work... And I suppose that's what t... |
**Matan Peled:** Yeah, and the code that it came from, what it is that it learned that would make it answer in this way, right? |
**Mat Ryer:** Yeah. |
**Natalie Pistunovich:** Yeah, it's actually exactly that that I wanted to bring up, all this AI creating code... Copilot is based on Codex. This is the engine that is running behind it. And a little bit from under the hood of how things are going on there - the plugin for Copilot is collecting some context which is no... |
But definitely, the ability of not needing a full working program in order to run such a test is a huge deal for that next step, so this is super-interesting. |
**Mat Ryer:** Yeah. By the way, when I first learned about Copilot, for some reason I read it as Copilot \[Copy Lot\], like it copies a lot... I thought it was like Camelot... So I completely misunderstood that it said Co-Pilot. I was using it for ages in the preview, and thought it was called Copy Lot. \[laughter\] It... |
**Matan Peled:** So one of the companies that I worked at during my masters, where I interned one summer - they used to be called \[unintelligible 00:26:24.09\] Now they merged with/bought out/became Tabnine, and they're making a very similar to Copilot tool. And they have the same ideas, only I think that what they do... |
**Mat Ryer:** That's so clever. One example I've seen of static analysis that surprised m, and actually got me quite excited about it, was an example case where if a variable at any point in the program is called password, and then at some other point in the program it's logged out somewhere, that would be then a warni... |
**Matan Peled:** Yes. So Perl, if you remember, if you've ever used it, has this whole idea where you need to sanitize your input, and bless them, and things like that. They had this idea that if you take input and you don't use it carefully, then it could affect the program in ways; SQL injections, and all that sort o... |
\[28:20\] That sort of analysis is called taint analysis, and I think that in recent years even, that sort of thing has become important, where you can leak out the password... And also just develop a related, but not the same idea, that a developer is just putting secrets into their GitHub repositories. And that's als... |
**Mat Ryer:** Yeah, and I'll tell you what - having that early... So we talked about the program doesn't have to be finished for this to work... Having that insight as you're working - that's really when you need it, because that's the point at which maybe you're making design decisions that you'll then have to live wi... |
**Matan Peled:** Basically, you can find bugs early. Other programming languages - Rust, if you read about it, put this whole idea of being very strict with the checking and the static analysis inside the language itself, and you can basically make sure that pointers don't go out of scope, and be used, because the lang... |
Other things you can do with that is, you know, if you're doing multi-threading and you have mutexes and other locks, you can use static analysis to make sure that after every lock is both locked and then unlocked, and you don't unlock something before you locked it, and things like that. Every allocation is freed if y... |
Some of those things, in some languages you have to check, so it makes sense to have static analysis for it, but in other languages it's not even a problem, because the language itself takes care of freeing resources. But in those languages that do use manual resource allocation, then that makes a whole lot of sense. A... |
**Natalie Pistunovich:** What are your thoughts about the static checkers in Go specifically? |
**Matan Peled:** So I don't know a lot about Go... I'm technically a professional Go developer, in the sense that someone once paid me money to write some Go... |
**Mat Ryer:** Oh... |
**Natalie Pistunovich:** That is the definition. |
**Mat Ryer:** Yeah, you're one of us! |
**Natalie Pistunovich:** \[laughs\] |
**Matan Peled:** But I'm not very good at it. So the one static checker that I've found for Go was called Staticcheck, and it seems to be quite thorough. It has a lot of linting options, and things that it can tell you that might be wrong about your Go program. |
So we've talked about all kinds of static checking, and we can talk about levels, but a lot of what Staticcheck mostly does is linting. So it looks for certain patterns of things that are dangerous, or might be incorrect, or are probably not what you meant to do, and then it warns about them... Which is a very useful t... |
It seems that it also has some deeper static analysis, because it can track contexts of various errors, and figures things like that... So it looks like a great tool. |
**Mat Ryer:** Yeah, there's actually quite a range of them, and some of them are general-purpose; others are very specific... There's a tool called Errorcheck that checks to make sure you don't ignore any errors, for example... Which is something that is quite important. |
\[32:11\] And then there's the Go Meta Linter, which essentially runs all of the linters and does those static checks; like you say, it's really linting, a lot of it... So we'll put some links to these in the show notes for people interested. But they're integrated nicely into IDEs already, so you probably already have... |
**Matan Peled:** The thing that I find interesting about -- like, I want to do the static analysis research... Make my own, basically. The linters are great, everybody should probably use them. Everybody probably does use them, because as you say, they're already integrated into the IDE... But every project has its own... |
For small projects, for scripts, you probably don't need that. But if you need to collaborate between multiple people that might do the thing, if you're a company or you're an open source project, then those things start to make a lot of sense. |
**Break:** \[33:33\] |
**Natalie Pistunovich:** What are some static checkers, from any language, that you saw, that you really liked what they do? |
**Matan Peled:** Oh... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.