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.md (4699B)


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