9 ms·
How a Zig IDE Could Work
- pyrolistical 4y agoReminds me of Eclipse days where they explained their Java compiler was more sophisticated than javac as they had to incrementally compile broken code as that is the main state of code during development. Maybe we need to do the same here
- systems 4y agoWhat happened to Eclipse, is it still big for Java developers ??
- DarkNova6 4y agoFor the most part, Eclipse has fallen into obscurity. But I doubt that it's competitors work any different in that regard.
- winrid 4y agoYeah, pretty sure Intellij does the same thing. A few bad lines rarely affects syntax highlighting/suggestions further down in the same file.
- nindalf 4y agoFun fact - The author of this post used to work at JetBrains on IDEs.
- sebzim4500 4y agoWhile everyone I know moved away from Eclipse years ago, if you look at the stats it is still a very widely used IDE. Maybe universities still get students to use it?
- mdaniel 4y agoI hope not, that would be malpractice However, I wanted to make the distinction that while @systems asked about Eclipse as a Java IDE, which it is objectively terrible at, Eclipse is like NetBeans in that it is multi-language[1] and is likely more accessible as an open-source C++ IDE for university use than trying to get CLion licenses (and, ahem, then explain CMake to students :-/ ) 1: yes, I'm acutely aware IDEA is also multi-language but the open source distribution only covers Java and Python, unlike Eclipse and NetBeans
- Kwpolska 4y agoCLion licenses are free for people with university email addresses, and perhaps you can figure out some basic subset of CMake to just compile a few files.
- strbean 4y agoIn my experience, university CS courses are always pushing woefully outdated tooling and avoiding any remotely modern standard practices like the plague. I was lucky to have one course in 2018 in which the professor actually included the most bare bones `git` usage. I actually never had a class in which an IDE was recommended. In 2008 I did have a class on C (first half C, second half Java) in which we were restricted to using C89 because that was most widely adopted in industry. I really missed block-scoped variables in for loops (`for (int i = 0...)`).
- mirekrusin 4y agoStudents should be learning how to move industries forward, not backward.
- KronisLV 4y ago> For the most part, Eclipse has fallen into obscurity. I guess it depends on the locale/company/environment? In most conferences, online videos, as well as among the people I know personally, JetBrains IDEs (IntelliJ IDEA for Java) seem to reign supreme: https://www.jetbrains.com/idea/ https://www.jetbrains.com/idea/ They have a community version, personally I pay for the Ultimate package of all the tools. They're slightly sluggish, want a lot of RAM, but the actual development experience and features make up for that. Hands down, the best set of IDEs that I've used from a pure development perspective - refactoring enterprise codebases mostly becomes something you can actually do with confidence. Running tests is easy. Integrating with app servers, containers, package managers or container runtimes is easy. Even remote debugging is easy to set up, as is doing debugging, or even testing web APIs. I'd say that all of the features that should exist do exist, which is more than I can say about many other IDEs. I know that Eclipse is sometimes used more in an educational setting, however there are also both some specialized tools, as well as customized versions for something like working with Spring in the industry: https://spring.io/tools https://spring.io/tools In my experience, the idea behind the IDE is nice (a platform that you can install whatever you want on, entire language support packages, or specialized tool packages), but the execution falls short - sometimes it's unstable, other times it works slow and so on. That said, it's passable. I would say that personally I'd almost prefer NetBeans to Eclipse, even after it was given over to the Apache Foundation, which have released a few versions since: https://netbeans.apache.org/ https://netbeans.apache.org/ It seems to do less than either Eclipse or IntelliJ IDEA do, but for general purpose Java editing and limited work with other stacks (PHP, webdev stuff, some C/C++) it is good and pleasant to use. However, if you have projects that get close to half a million lines of code, it does just kind of break and gets way slower than the alternatives. It still somehow feels more coherent than Eclipse to me, would pick it if IntelliJ IDEA didn't exist. Some also try doing something like using Visual Studio Code with a Java plugin: https://code.visualstudio.com/docs/languages/java https://code.visualstudio.com/docs/languages/java That said, I only used that briefly when I needed something lightweight for a netbook of mine, the experience was somewhat underwhelming. The autocomplete or refactoring wasn't as good as IntelliJ IDEA and just felt a little bit tacked on. Then again, that was a while ago, I don't doubt that progress is being made.
- fiddlerwoaroof 4y ago
- delusional 4y agoThat's not quite fair. I don't have any numbers, but i suspect a few developers are using vscode which uses the jdt.ls language server. jdt is basically just a wrapper around the non-ui parts of eclipse. Eclipse lives on, although the IDE itself might not see much use anymore.
- pjmlp 4y agoI guess we are obscure developers, with our Visual Studios and Eclipses. Eclipse headless is also what powers VS Code Java support, with Red-Hat and Microsoft as main developers. You know, the reason why JetBrains had to rush out Fleet.
- DarkNova6 4y agoI've seen many people begin projects with VS code and end it with Intellij or another jetbrain product. To be fair, I use VS Code as well. It works well as a text editor.
- tooltitude 4y agoYou actually could do a lot of stuff in VS Code. See rust-analyzer or our extension: https://marketplace.visualstudio.com/items?itemName=tooltitudeteam.tooltitude https://marketplace.visualstudio.com/items?itemName=tooltitu...
- mindcrime 4y agoEclipse may not be as popular as it used to be, but saying it has "fallen into obscurity" is wild hyperbole. It's still very popular, albeit maybe not so much with the SV startup crowd which is so prevalent on HN.
- IshKebab 4y agoI don't think so (IntelliJ is way more popular). I think Eclipse is mostly popular these days as a platform for companies offering custom tools. For example Team Center (which is awful btw). Honestly Eclipse was always pretty awful and I have yet to use any Eclipse based software upon which that awfulness didn't at least leave a mild stench. Check out this list: https://en.wikipedia.org/wiki/List_of_Eclipse-based_software https://en.wikipedia.org/wiki/List_of_Eclipse-based_software
- 3836293648 4y agoEclipse the IDE is mostly dead, but its Java analysis was moved into a language server and is the goto option for people in vim, emacs and presumably VSC, though the last option isn't as open as the first two in what the extension actually uses under the hood.
- pkphilip 4y agoI still use it.
- j16sdiz 4y agoI love eclipse back in its day. It worked great for me until everybody started using Maven. Eclipse tried to use the same approach for maven and wrote their own parser/processor to inject the Maven build file. This failed miserably.
- nickcw 4y agoThis is very different to most static languages. From the article: The whole process is lazy — only things transitively used from main are analyzed. Compiler won’t complain about something like fn unused() void { 1 + ""; } This looks perfectly fine at the Zir level, and the compiler will not move beyond Zir unless the function is actually called somewhere.
- planede 4y agoYeah, it looks like Zig is a bit overly lazy. As a comparison, what C++ does is that it differentiates between "dependent" and "non-dependent" expressions, where "dependent" means that it depends on some template parameter (analogous to comptime parameter here). "non-dependent" expressions are type-checked eagerly, while dependent expressions are only checked at instantiation time. The design is certainly more complicated, even more so when you consider function overloading and name lookup, which can give different results if done late or early. But there are some upsides, and zig wouldn't need to deal with the additional complications of overloading. edit: https://eel.is/c++draft/temp.dep https://eel.is/c++draft/temp.dep
- skywal_l 4y agoWell it's basically like C macros. The C compiler won't see any code that's behind a deactivated macro. Same thing for zig here, except you don't have to deal with an unreadable macro language full of pitfalls. All is done in the language itself.
- stephc_int13 4y agoGetting rid of macros (and all of their well documented pitfalls) is good. Getting rid of the preprocessor and conditional compilation may not have been necessary. (as the feature is needed anyway and have to be implemented in a different manner) The thing is that comptime, even if better than macros because everything is written in the same language, might end up not being much better than C macros. Many of the macro pitfalls still applies, if you think about it...
- 4y ago
- nusaru 4y agoWas hoping the author found a solution to (in my view) Zig's biggest shortcoming with generic types: a parameter that accepts all instances of a generic type must either (a) be declared as "anytype" or (b) also require a comptime parameter for the generic type argument. For example, the standard library passes around instances of std.io.Writer as anytype, so zls auto-completion doesn't work. Also see: comptime interfaces proposal https://github.com/ziglang/zig/issues/1268 https://github.com/ziglang/zig/issues/1268
- Kukumber 4y agoI agree with that, the language needs some love in that area
- remorses 4y agoInterfaces are the most important thing Zig needs to implement ASAP It would also help creating a uniform standard library, for example creating a Writer interface instead of having specific functions for files, sockets, buffers and all kind of types
- jimbob45 4y agoHow are you going to implement interfaces if Zig is without classes in the first place?
- mirekrusin 4y agoGo has interfaces and doesn’t have classes.
- akira2501 4y agoThere's quite a bit of mildly hairy runtime code necessary to achieve this.
- anonymoushn 4y agoFor the equivalent thing (interfaces with runtime dispatch and without owning the underlying struct) Zig has explicit vtables. I sort of think any new "interfaces" feature should at least partly be about describing constraints on types at compile time.
- fb03 4y agoContext: Matklad is the main dev behind rust-analyzer
- 3836293648 4y agoAnd a major dev behind intellij rust
- molenzwiebel 4y agoHe used to be. He recently left the rust-analyzer and rust compiler development teams to broaden his horizons, and is working full-time on a project that uses Zig now (which no doubt sparked this thought experiment).
- faitswulff 4y agoDo you have a source for that? I'd be interested to read more about it
- rofrol 4y agohttps://tigerbeetle.com/blog/2023-01-30-series-seed-announcement/ https://tigerbeetle.com/blog/2023-01-30-series-seed-announce...
- faitswulff 4y agoInteresting, but it doesn’t say matklad is stepping down from rust-analyzer
- molenzwiebel 4y agoApologies, I accidentally confused matklad with jonas-schievink, a different r-a contributor that recently became a rust project alumni [1]. It seems matklad is still active on r-a. [1]: https://github.com/rust-lang/team/pull/931 https://github.com/rust-lang/team/pull/931
- norir 4y ago> works with incomplete and incorrect code I know that this is a standard assumption, but I personally believe that it is a mistake to support this use case. It is a holdover from the batch processing days when getting feedback on your program could take minutes or hours. In those conditions, it was absolutely essential to try and proceed with a partial compilation even in the presence of errors or else iteration would have almost been impossible. Now we live in an era of fast personal computers. With a language that is designed from the ground up with IDE support/rapid iteration in mind, you can get feedback with every keystroke. Everything is easier to design if you abort immediately on the first error, whether it is syntactic or semantic. Designing a parser with error recovery from syntax errors is a particularly dark art. On some level, you have to resort to guessing. It may work _most_ of the time, but to me there is nothing worse than a tool that is maybe correct. When you advance past an error all of the code below the error is suspect. To give a trivial example, let's say you rename a function with 100 call sites without some kind of refactoring (automatic or manual). What benefit is there in showing the 100 new failures when the root cause is exactly where your cursor already is? There are cases like this that are even subtler where you are bombarded with downstream error messages that are confusing and taking you away from the actual root of the problem (c++ template errors come to mind). You may as well just gray out everything below the first error and reprocess it only when the error is fixed.
- IshKebab 4y agoI think you have misunderstood. He's talking about IDE support. IDEs absolutely must be able to understand incomplete or incorrect code otherwise code completion will be completely useless. You literally only need code completion when your code is incomplete. The clue's in the name.
- norir 4y agoI am focusing on the incorrect part. Let's say that you are adding some source code in the middle: ... def add(x: Int, y: Int) = x + y ... let x = ad|> I am using |> to denote the cursor location ... I agree that where the |> is that the IDE should be able to autocomplete `add` for you. What I am saying is that it shouldn't process anything below the let statement because the code is broken there. Many IDEs and compilers will continue processing the file after the first error so that they can report all of the findings. That is what I am suggesting they not do.
- danybittel 4y agoI recently watched an excellent Talk about IDE integration with Rust. Maybe worth checking out: https://youtu.be/N6b44kMS6OM https://youtu.be/N6b44kMS6OM