logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

A-new-systems-language.gmi (4043B)


  1. It’s an open secret: the “secret project” I’ve been talking about is a new systems programming language. It’s been underway since December ‘19, and we hope to release the first version in early 2022. The language is pretty small — we have a mostly complete specification which clocks in at 60 pages. It has manual memory management, no runtime, and it uses a superset of the C ABI, making it easy to link with libraries and C code. It should be suitable almost anywhere C is useful: compilers, system utilities, operating systems, network servers and clients, and so on.
  2. ```A "hello world" code sample
  3. use io;
  4. export fn main() void = {
  5. const greetings = [
  6. "Hello, world!",
  7. "¡Hola Mundo!",
  8. "Γειά σου Κόσμε!",
  9. "Привет мир!",
  10. "こんにちは世界!",
  11. ];
  12. for (let i = 0z; i < len(greetings); i += 1) {
  13. io::println(greetings[i]);
  14. };
  15. };
  16. ```
  17. We could compare our language to many other languages, but let’s start with how it compares to C:
  18. * More robust error handling via tagged unions
  19. * Improved, Unicode-aware string support
  20. * Memory safe array, slice, and pointer types (and unsafe versions, if needed)
  21. * Direct compatibility with the C ABI for trivial C interop
  22. * A simpler, context-free, expression-oriented syntax
  23. * A standard library free of the constraints of POSIX or the C standard
  24. Our language currently supports Linux on x86_64 or aarch64, and we plan on expanding this to the BSDs, Haiku, and Plan 9; as well as i686, riscv64 and riscv32, and ppc64 before the release.
  25. I plan to continue keeping the other details a secret until the release — we want the first release to be a complete, stable, production-ready programming language with all of the trimmings. The first time most people will hear about this language will also be the first time they can ship working code with it.
  26. However, if you want to get involved sooner, there’s a way: we need your help. So far, we’ve written most of the spec, the first of two compilers, and about 15,000 lines of the standard library. The standard library is what needs the most help, and I’m seeking volunteers to get involved.
  27. The standard library mandate begins with the following:
  28. > The •••• standard library shall provide:
  29. >
  30. > * Useful features to complement •••• language features
  31. > * An interface to the host operating system
  32. > * Implementations of broadly useful algorithms
  33. > * Implementations of broadly useful formats and protocols
  34. > * Introspective meta-features for ••••-aware programs
  35. >
  36. > Each of these services shall:
  37. >
  38. > * Have a concise and straightforward interface
  39. > * Correctly and completely implement the useful subset of the required behavior
  40. > * Provide complete documentation for each exported symbol
  41. > * Be sufficiently tested to provide confidence in the implementation
  42. We have a number of focus areas for standard library development. I expect most contributors, at least at first, to stick to one or two of these areas. The focus areas we’re looking into now are:
  43. Algorithms: Sorting • compression • math • etc
  44. Cryptography: Hashing • encryption • key derivation • TLS • etc
  45. Date & time support: Parsing • formatting • arithmetic • timers • etc
  46. Debugging tools: ELF and DWARF support • vDSO • dynamic loading • etc
  47. Formats & encodings: JSON • XML • Gemtext • MIME • RFC 2822 • tar • etc
  48. •••• language support: Parsing • type checker • hosted toolchain • etc
  49. Networking: IP & CIDR handling • sockets • DNS resolver • Gemini • etc
  50. Platform support: New platforms and architectures • OS-specific features
  51. String manipulation: Search, replace • Unicode • Regex • etc
  52. Unix support: chmod • mkfifo • passwd • setuid • TTY management • etc
  53. If any of this sounds up your alley, we’d love your help! Please write me an email describing your interest areas and previous systems programming experience.
  54. Update 2021-03-20: We're targeting the first release in early 2022, not 2021.