5 ms·
I still think the fact that even most people with a 4-year degree still haven't done a compilers course is the core problem. Both other times we've had this dis
by jerf 11y ago
I still think the fact that even most people with a 4-year degree still haven't done a compilers course is the core problem. Both other times we've had this discussion I haven't noticed anyone popping up to say "Yeah, I've written like 3 compilers and Wasabi was just an insane idea." (Of course, the Internet being what it is, someone will probably say that now. But the point is I haven't seen it before I asked for it.) A lot of people are doing the cost/benefit analysis with an order of magnitude or two too much in the "cost" column. Yeah, of course it looks insane then... but the problem is the analysis, not the reality.
Compilers just aren't that magically hard and difficult. I'll cop to not having written a true compiler yet but I've written a number of interpreters, and I've written all the pieces several times (compile to AST, interpret, serialize back out, just never had the whole shebang needed at once).
If you're reading this, and you're still in a position where you can take a compilers course, take it! It's one of the most brutally pragmatic courses in the whole of computer science and it's a shame how it's withered. (Even if, like me, you'll probably write more interpreters than compilers. And nowadays you really ought to have a good reason not to pick an existing serialization off-the-shelf. But it's still useful stuff.) It's one of those things that is the difference between a wizard and a code monkey.
(If I said that too concisely for your tastes, see: http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html http://steve-yegge.blogspot.com/2007/06/rich-programmer-food... )
- tptacek 11y agoRight! And this isn't even a compiler, the way most people think of "compilers". It's a transpiler to three target languages each of which has an extraordinarily full-featured runtime. Two of which are (a) widely available and (b) as source languages, awful.
- cwyers 11y agoAnd it's not their own language, it's an extension of VBScript. And now that the tools around C# are better and Linux support for .Net is official, they have used these tools to transition to C#. Like you, I don't get the outrage.
- slantyyz 11y agoDo you think that the name Wasabi contributes to the outrage? Coffeescript has a similar name to Javascript, so you can quickly draw an association between the two. The name Wasabi doesn't have an obvious connection to the VBScript that it's based on, which seems to be the cause of people talking about writing a whole new language, etc.
- krallja 11y agoWe had a (re)naming competition for the language, and Wasabi came in second. The winner was actually Bone Crusher 3000. http://blog.fogcreek.com/the-origin-of-wasabi/ http://blog.fogcreek.com/the-origin-of-wasabi/ Thistle -> FogBasic -> BC3k -> Wasabi
- x0x0 11y agoAnd if this targeted (asp or php) to js, people would love it.
- tedunangst 11y agoJavascript was one of the backends.
- marssaxman 11y agoI've written like 3 compilers* and Wasabi seems like it was probably a reasonable solution for the problem they had at the time. Compilers just aren't that magically hard and difficult. * Five, actually, and contributed to a sixth
- meatysnapper 11y agoThere are very few situations where writing your own langue and toolchain is a good idea. I used to work on a proprietary company language that was actually a compiler generator for language-to-language translation, plus a bunch of other stuff, and it was a horrible pain. Documentation? None Online community? None Transferability of skillset? None, apart from knowing how compilers work. Makes for good nerd conversation, but that's it. Writing your own toolchain is almost as bad. I've seen multiple talented people leave companies I've worked at when they were forced to build and maintain horrible tools for the in-house ecosystem. Some too-big-for-his-britches second-system-as-a-first-system ass had written them, and everybody else got stuck with it. As the other commenter noted, this seems like epitome of bad software engineering and I'm surprised employees put up with it if they were any good. EDIT: I learned to program in assembly, so compilers didn't seem super mysterious to me as they are for someone who learns Java first perhaps.
- tptacek 11y agoCan't you say the same things about a proprietary database, or a proprietary template language? What are the kinds of computer science that we can safely deploy without taking extra precautions to document and maintain it?
- meatysnapper 11y agoYes. Any proprietary system will require you to document/educate the users, and you will not have the benefit of an online community to get help from, or bug fixes, or security analyses. There are very few problems where rolling your own solution is the right solution. Maybe if you are Google and your database isn't big enough or something. If you have great people building the software, or at least competent ones, and you have competent users, you might succeed, maybe. But that's assuming you have a maintenance plan and a roadmap, which most software companies do not. Maintain software? YOLO! What happens when you have a bunch of morons using and maintaining the software? In short, computer science in industry is largely practiced as shamanism by people who cannot engineer their way out of a crackerjack box.
- nostrademons 11y agoI've written like 3 compilers, and while I don't think Wasabi was quite insane (they had an interesting set of constraints, so I could at least follow the logic), it's not the choice I would've done. Or rather, it's totally the choice I would've done as a fresh college grad in 2005 having written my first compiler for work (which was ripped out in about 2 months...it didn't take me that long to realize my mistake), but it's not what I would've done with the hindsight experience of that and other compiler projects. The cost of an in-house programming language isn't in writing the compiler. It's training all your new team members in the language. It's documenting the language constructs, including corner cases. It's in not being able to go to Stack Overflow when you have problems. It's in every bug potentially being in either your application code, your compiler, or your runtime libraries, and needing to trace problems across this boundary. It's in integrating with 3rd-party libraries, and in not being able to use tooling developed for an existing mainstream language, and having to add another backend to every other DSL that compiles to a mainstream language. All that said, I agree that if you're ever in a position to take a compiler course, do it. It's one of the most valuable courses I ever took, and really peels back the mystery on why programming languages are the way they are. It's just that the difference between wisdom and intelligence is in knowing when not to use that brilliant technique you know.
- jerf 11y ago"It's just that the difference between wisdom and intelligence is in knowing when not to use that brilliant technique you know." Which is precisely why I've never written a full compiler, even though I've written all the pieces many times. For instance, instead of writing a parser, could you perhaps get away with just a direct JSON serialization of some AST? Do you really need to emit something, or will an interpreter do? So far I've never been so backed against the wall that I've actually needed a full compiler.
- tptacek 11y agoI'm doing this now, for a crappy language and a crappy processor. It's been a nightmarish hellscape of a project, but also very expanding. Highly recommend. (If you're interested in goofing around with Starfighter, you're going to get an opportunity to get handheld through a lot of this stuff.)
- tveita 11y agoI've written some toy compilers, and I can at least say: 1. compilers have bugs 2. it really sucks not knowing if a bug is in your code or in your compiler 3. it sucks not having a source-level debugger Anyone can write a simple compiler, just like anyone can make a simple database. The hard part (at least for a non-optimizing compiler) isn't the comp-sci theory, it's making the tooling around, and the extensive amount of testing needed to be sure you don't have subtle data corrupting bugs lying around to bite you. I won't categorically reject the idea, for instance I think Facebook writing their HipHop compiler was completely defensible. But you need people with compiler experience, and people who know the pain of working with crappy, undocumented, buggy toolchains to make that decision, not people who once took a compiler course.
- thedufer 11y agoYou might enjoy reading http://www.tedunangst.com/flak/post/technical-debt-and-tacking-into-the-wind http://www.tedunangst.com/flak/post/technical-debt-and-tacki.... To address your points: > Fun fact: Wasabi has more unit tests than FogBugz. > It’s fully debuggable in Visual Studio. Breakpoints, variable inspection, single stepping, the whole enchilada. But the whole post makes it clear that working in Wasabi wasn't nearly as difficult as you think.
- mwcampbell 11y agoI didn't take a course on compiler construction, and now I don't remember if my university's CS department had one (it was a fairly mediocre CS department at a state university). Now I wish I had. Do you think a good compiler course would prepare the student to do a project with the scope and complexity of Wasabi? For one project, I wrote an interpreter for a little domain-specific language, then later reworked that interpreter into an on-the-fly compiler (to Lua, to avoid double interpretation). But that's a long way from writing a compiler for a general-purpose language, that can do global type inference and produce human-readable output in a target language that's fairly different from the original VBScript (if not Wasabi itself).
- krallja 11y agoSee https://news.ycombinator.com/item?id=9778928 https://news.ycombinator.com/item?id=9778928 for more. The trickiest bit of Wasabi is the type inference, which I admit is not "production-ready" (or "good code") because we basically invented it from scratch. If I were to do it now, I would know just enough to realize that I need to read about Hindley-Milner rather than reinvent the wheel. Producing human-readable output is an exercise in tedium and bookkeeping, not any particular amount of skill or brilliance.
- mwcampbell 11y agoThanks for confirming my guess that the type inference was the trickiest part. These days, I guess Flow (http://flowtype.org/ http://flowtype.org/) would also be worth studying. Edit: Or PyPy's RPython.