Transcript
00:00:00Vassal just released a new programming language called Xero, and supposedly what makes this
00:00:03one different is that it's been built from the ground up so that humans and AI agents
00:00:07can ship small native programs together. But isn't this what we've all been doing anyways?
00:00:12So what makes this one better, and is it actually a good idea, or is it just another side project
00:00:16that nobody's going to be talking about in a few months? Let's find out.
00:00:25Xero is a systems language like Rust or Xig, so maybe something that BUN can rewrite to one day.
00:00:30And as far as I can tell, the whole idea is that current languages were built for humans.
00:00:34So we read the error messages, the warnings, and the traces, but AI works much better when it has
00:00:38structured data. So with Xero, the entire toolchain has been built with that in mind,
00:00:43meaning that everything the compiler produces can be output as JSON.
00:00:46Now just based on those points alone, and the pretty obviously AI written sentences on this website,
00:00:51I'm still pretty skeptical on why this exists and how well it's going to work,
00:00:56but I'll save my opinions for the end. First let's just explore the language itself,
00:00:59because I mean it is still pretty cool. We'll start with the classic "I'm learning a
00:01:03new language" project, printing out a very simple string. Most of this is pretty easy to understand.
00:01:08We have a public main function as the entry point to this program. This function is going to return
00:01:12void, and inside of here we're printing out a string. But it's the way that string is being
00:01:16printed that points out our first few features. We are using the world capability. You need this
00:01:21capability if you're doing any I/O operations, like file operations, printing, network calls,
00:01:26any I/O side effect, and it's all part of the explicit principle of this language.
00:01:31If a function has this world capability, it's an immediate signal that it does some I/O operations,
00:01:37and if it doesn't have it, it means it's going to be I/O side effect free.
00:01:40The world capability also allows the compiler to reject unavailable capabilities based on the
00:01:45target at compile time instead of runtime, so if you try to use file system access within this
00:01:50function and then try to target a web assembly build, the compiler would error out first,
00:01:54so you're not going to be surprised by a runtime error later down the line.
00:01:57After the world capability, in this program we also have some keywords.
00:02:00So we have check here, which is how you handle errors. If a function is able to fail,
00:02:05you mark it with raises, and then check here is used to propagate that error. It's pretty similar
00:02:09to Rust's question mark operator, but just as a keyword. So that's everything we need to know
00:02:13for our first program within Xero, and we can run this now by doing xero run and hello.xero.
00:02:19Note this is the file extension for the Xero language. If I hit enter on this now,
00:02:23you can see it says hello, subscribe to Betastack. Something you should definitely do.
00:02:26Moving on from our hello program though, since we're clearly all Xero experts now,
00:02:30the language does have a few more primitives to keep you covered for your basic applications.
00:02:34So I made a new one here which is just a random app that will classify whether the input is text,
00:02:39numeric or mixed, and you can see that this uses some features like standard libraries that we have
00:02:43we have enums in here, we have shapes, pretty similar to structs, then we have the usual
00:02:47language features you'd expect like if statements, we have a while statement down here, you can also
00:02:52use for loops, then we also have match down here which is pretty much like your switch statement.
00:02:56So nothing too unexpected or new. When it comes to more advanced concepts like memory, again with Xero
00:03:00everything should be explicit. So we have mutable spans for our writable views and there's also spans
00:03:05for readable views, and down here we have an owned type. This essentially says that this value is
00:03:10owned here and when it goes outside of scope run the drop function. We define the drop function
00:03:14ourselves on the shape here so this is where we would put our cleanup logic. Another way you can
00:03:18do this is by using the defer keyword and then putting a function here. Essentially what this
00:03:22means is when this function is done and it goes out of scope run this function afterwards. So it's
00:03:26basically got everything you need for a very basic application today and there is a few more features
00:03:31but I don't really want this to be a programming tutorial but do feel free to put that you have
00:03:35three minutes of Xero experience on your CV. With all of that out of the way then let's focus on what
00:03:39I think is the real pitch for Xero and that is its toolchain and the fact that it's been built for AI
00:03:44agents. Imagine an AI agent writes some Xero code and it introduces some bugs. Well they claim that
00:03:49in most languages you're just going to get back a wall of text and those error messages are designed
00:03:54for humans to read. In Xero you can actually get the human readable one and it's going to look
00:03:58something like this but you can see that's not a structured output. So they've made sure that in
00:04:02every part of the toolchain it actually has a JSON option. So if we run that same function again but
00:04:07this time using the JSON option and I'm also piping this to JQ just so it looks a little bit nicer
00:04:12you can see we get back a nice structured output error message. We have diagnostics here like the
00:04:16severity, the code and the message. We have where the error is occurring, its expected value and its
00:04:21actual value. Then we have some help for the actual LLM itself as well as a fixed safety field which
00:04:26says this is going to require human review and then some information about how this can be repaired. So
00:04:31it's just trying to give enough context to the LLM so it can fix it itself. Another command that shows
00:04:35that off well is the Xero fix one. This one I'm using with plan mode as well as JSON and also
00:04:40piping it to JQ just so it looks nice in our terminal. When I hit enter on this it essentially
00:04:44does a diagnostic on the classified broken file that I gave it and it essentially says what do I
00:04:49need to do to actually fix this file. You can see we get a structured output back with fields that
00:04:53pretty much only an LLM needs to know like safety levels, the mode, applies, edit. We have things down
00:04:58here like self-host repair policy. We then have the diagnostics section which is pretty much the same
00:05:03thing that we saw in that Xero check command and down here we also have the fix for that error code
00:05:07itself. So how is this typically fixed? Essentially part of the idea seems to be what if the language
00:05:12provided its own documentation when it was needed. So if we pointed an LLM at this new language it
00:05:17wouldn't really need to look up any documentation or use any skills it would just be able to get
00:05:21enough information from the toolchain when it's actually needed. So to put that to the test I put
00:05:25our broken file in a brand new directory that has no information on what the Xero language is and now
00:05:30I simply ask Claude to fix that broken file and also give it the command that it needs for those
00:05:34diagnostics because it does need some information on how to actually use the toolchain. With that
00:05:38we can go ahead and see if Claude can actually fix this file. Well there we go after 31 seconds it's
00:05:43managed to fix all of the errors in the file and I actually introduced three of them and it's found
00:05:47all three and fixed them and we can scroll up and see how it's done it. It is simply just running that
00:05:51Xero fix command that I gave it. This time we got back okay true so that's how it knows there is no
00:05:56errors left and if we scroll up we can see that it made some code changes and it did that because in
00:06:00the previous step it ran Xero fix and got some information on how exactly to fix that issue and
00:06:05it did that with all three of the issues that we had. So this had no prior information on what the
00:06:10Xero language is it didn't use any web search or anything like that to fetch the documentation it
00:06:14simply used the information that the toolchain provided as structured outputs. I'm actually a
00:06:18little impressed by that this is a brand new language that an LLM can still debug thanks to
00:06:22how the language has been built but there is one thing I'm left wondering is this really new? I mean
00:06:28I get the whole selling point of errors and everything in the toolchain having structured
00:06:31outputs but that's not really a new concept we've had structured error messages for decades. I mean
00:06:37look at this I have roughly the same classified program built in Rust and it has similar errors
00:06:41and I can just ask for the output to be in JSON. I'm not really sure that we needed a whole language
00:06:46to be built around this idea and maybe you could have just improved the existing ones if you thought
00:06:51there was a gap in the information. I'm also pretty sure that if I took that broken Rust code and asked
00:06:55Claude to fix it he'll be able to do so with ease and that would be even if it wasn't using structured
00:07:00outputs. I feel like LLMs do a perfectly okay job with normal messages or maybe I just haven't run
00:07:05into that issue. On top of that we have the fact that LLMs have been trained on loads of existing
00:07:10coding languages like Rust so it's going to be pretty good at debugging that and it has lots of
00:07:14examples in its training data but with Xero it has absolutely none. Now that doesn't mean you should
00:07:19never try and add in a new language it just means if you're building a complex app you wouldn't reach
00:07:24for Xero but to be honest with you they're not really marketing it as that anyways. Overall I
00:07:28think this is just a neat experiment and if anything it does show that you can still build a new language
00:07:32and give LLMs required context without having them be trained on that language but I'm just not really
00:07:37sure if this was needed. None of that is to say that the language itself isn't cool. As I said it's
00:07:42actually not that bad to use and it does compile down to a nice size. I just doubt that I'm ever
00:07:47going to use this over established ones like Rust, Zig or Go. I'm sure there's going to be lots of
00:07:51opinions on this one so let me know what you think in the comments down below or hit that subscribe
00:07:55and as always see you in the next one.
Community Posts
No posts yet. Be the first to write about this video!
Write about this video