r/ProgrammingLanguages • u/AnyOne1500 • Apr 01 '26
Language announcement Been making a language called xs, feedback pt 2?
http://xslang.orgRecently I made the post: https://www.reddit.com/r/ProgrammingLanguages/s/PZJVCdlzJ9
I got a lot of feedback on it. Since then the language and installer has changed a lot. Now I've made a website for it on xslang.org and an easier way to install.
You can either curl/irm it (easiest) or install xsi (xs installer) manually and do xsi install --auto, which sets it up the same. Check the xslang.org website for more info.
There is also now officially a registry on reg.xslang.org. Using xsi you can publish and install packages, which is neat.
The latest version (as of writing this) for xs is v0.3.6, and for xsi it's v0.4.1. It's been a huge update since my last post, so let me know what y'all think!
4
u/Inconstant_Moo 🧿 Pipefish Apr 02 '26
This is nice, I seem to have missed it the first time around.
Putting the contracts in the type signature will get awkward with anything more complicated than your example. This is especially a concern since functions can have this sort of validation in their bodies, so this can only be intended as syntactic sugar, and yet it gets unreadable quickly.
A more useful application of this sort of thing is to attach it to types, so as to e.g. ensure that a
Datestruct will always contain a valid date.I feel like reactive bindings are an outright misfeature. Their existence imposes a permanent cognitive burden --- if they're in the language, then whenever I'm reading some xs and I see an identifier, I have no way just looking at the local code of knowing whether it might be one of these magical beasts obeying hidden semantics. I have to think about that every time. I have to think about it in the 99% of cases where the author of the code hasn't done that, because they always might have. The mere possibility of unseen nonlocal magic is going to take up some of my working day.
And we have an alternative to them called "writing a function".
2
u/antonation Apr 02 '26
Really cool tagged blocks, never seen that before. What's the inspiration for that?
3
u/semanticistZombie Apr 02 '26
Sorry to be that guy, but this has to be vibe-coded, right? Unless you're a programming god, you aren't writing a whole language implementation with a language server, VM, type checker, ... all in 87kloc C (not even C++! no dependencies), in 109 commits. The web site is definitely vibe coded (I've seen the same site dozens of times already), but the implementation is too. The code barely has comments, but documents the most obvious things, like
/* Method return type requires full resolution; walk the object */which is an obvious sign these days, coding agents do this for some reason. (they figure out most complicated things, then document trivial things) It also barely has any tests, which is another sign of coding agents.Note that I care too much, but I wasted a few minutes already trying to understand this. It would be good to follow the subreddit rules which would save my time.
9
u/willowless Apr 02 '26
when you make it to version 4 it'll become a bit too xsiv.
1
u/Leather_Speaker_5315 Apr 02 '26
The release files contain basically the compiler itself as an executable binary. No vsix file, No link to the extension at vscode-marketplace or open-vsix repositories, No positive results when I searched for "xs" (in vscode) where apparently there is two other plugins for two other languages named xs too. So I'm confused.
Other than that: The language looks promising 👍
Keep up the good work 😊
1
u/lookmeat Apr 02 '26 edited Apr 02 '26
My bits here.
First of all very cool project, looks pretty mature from the website, and the docs.
I can only think of nitpicks (e.g. I'd call nurseries something that hints a bit more, such as TaskScope or WorkSpace or something like that, especially when you realize that nurseries don't just birth baby tasks, but take care of them through their whole life and furthermore in the future eventually end up evolving into something like Java's ExecutorService).
One thing I could think is that you could allow the creation of "scoped" effects, and then turn nurseries into an effect within the system, this would just simplify the language a little bit, and limit things by scope. How to do this would change your language notable. I am not sure if some of these are limitations of being something that can work with the browser, but I think that the language could be simplified a little bit more, i.e. a lot of features could become just libraries that build on other features.
Error effects could be made more powerful by allowing them to return to key places, either where a scope is defined (basically try-catch with throw exceptions, using scopes as the foundation, this basically matches what you'd expect the nursery concurrency pattern to handle) to the return of the calling function (working as
Resultwhere the error is just returned) or return to where the error happened with some recovery. You could probably add a bit of library wrapping on this concept to give people the ability to choose how to handle the error. Especially if you want people who choose to not handle an error and instead forward it, to do so, in a way this should be valid for effects that "return" to some key point ahead, you could say that rather than return here, you want to go back further ahead to the next "recovery" point. This is general is something you could see with other effects, because people will want to do continuations with effects.I'd like to see an example of effects as continuation. Also can we limit on effects? Say forbid a function from calling directly or indirectly an effect, basically as if we could replace within a scope the effect handler with one that throws an error. I imagine it can just be implemented like this, but it'd be great to have examples.
Overall great bones and foundation, feedback is that standard library should expose certain features in either a more raw, or a more friendly form depending on what makes sense. And again an exploration of merging certain features to only be variations on others. The more straightforward and minimalist a language can be, the easier it can grow in the future, especially once it starts getting non-trivial external uses (i.e. non lang developers building complex libraries and software).
1
u/-TheDark- Apr 02 '26
Looks really cool! I like a lot of the ideas in here. I do wonder though: is there any difference between `int` and `i64`, `float` and `f64`, `str` and `string`, `any` and `dyn`, or `void` and `unit`? If not, why have multiple? Additionally, can you create your own universal literals? And if so, will the compiler warn you on double-usage?