home.social

#languagedesign — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #languagedesign, aggregated by home.social.

fetched live
  1. Self-host your compiler, you cowards!

    Several times this year, I've read about new systems programming languages, usually created with robotic help. That's great! New languages expand how we think about programming. I've noticed their compilers are almost always written in Rust.

    Rust is a fine systems programming language in its own right, but a systems programming language, the kind of language meant for writing things like compilers, ought to be used for its own compiler before it's used for any other serious work.

    I'm kidding about the cowards part of course. I'm sure all language designers are brave and kind, even if some look like serial killers.

    @programming

    @[email protected]


    #programming #languagedesign #rust #compilers
  2. Running Code in a Programming Language Nobody Knows

    Last month, I ran code in a programming language that nobody knew.

    I'm not the first to do a thing like that. Ben Olmstead created Malbolge in 1998. It's a deliberately incomprehensible programming language that's likely impossible for anyone to really know; it took a search algorithm to generate the first program for it. Finding examples of an old, obscure language with no surviving practitioners is another potential method I imagine has been done a few times.

    Nobody had ever known Nucleus when its compiler bootstrapped. Since it's 2026, I imagine many readers have already guessed large language models were involved. I gave a sample program and output to an LLM tool and told it to write a compiler in C. I then told the tool to add features to the language until it could rewrite the Nucleus compiler in Nucleus, resulting in a language that I did not know. LLMs do not "know" things and aren't somebody, so at that point, nobody knew Nucleus, yet there were about 4000 lines of it running in the compiler, able to produce real binaries that run on real computers.

    Someone I mentioned this to asked why I would want to design a programming language without designing a programming language. I don't actually want to do that, but just as the compiler needed an initial implementation in another language in order to bootstrap, I found it much easier to work from a minimal working language than a blank slate. I had the idea for Nucleus for a long time and have not yet read the Dragon Book and written a compiler from scratch like I told myself I was going to.

    As for the language itself, the basic idea is a language for manipulating memory at a low level like C, but with Lisp-like syntax and structural macros providing compile-time abstractions and safety-enhancing constructs with no runtime overhead. By the time it hits 1.0, Nucleus should be usable as a drop-in replacement for C anywhere C is used. I'm not the first to do a thing like that either, but other implementations I've seen actually compile a Lisp-like language to C. Nucleus targets LLVM directly.

    @programming

    @[email protected]


    #lisp #LanguageDesign #compilers
  3. I love how C# designers are trying to speedrun the reinvention of unions. 😅

    #csharp #LanguageDesign

  4. I treat := as a proxy for "the language creator is at least slightly annoying".

    I have been happy with the hit rate so far.

    #LanguageDesign

  5. People need to stop taking language design advice from language creators whose only accomplishment is that their language got popular.

    #LanguageDesign #compilers

  6. @CGM I see good in this: new and useful powers for #Python.

    I see bad in this: a thing we knew about for a long time, present elsewhere, why so long coming?

    I see neutral in this: things that can be provided by libraries instead of directly in the language should absolutely start in a library. If they earn a spot in the language itself, great.

    I see sad in this: these words make it sound like #TCL is ahead and Python is behind overall. That doesn’t match my opinion or personal experience. Absolutely agree on this particular feature. And also I have stated many times "there is no best language", just choices more or less cost-effective for the problem at hand.

    For the problems I’ve faced, with the tools I’ve had available, Python has been a more cost-effective choice than TCL the majority of the time. From your words, I took that you prefer TCL. Nothing wrong with that!

    #LanguageDesign #TailCallOptimization

  7. After thought (thought I didn’t plan to put into it), I don’t think "NULL coalescing" and "NULL chaining" needs to be built in to the #ProgrammingLanguage, and here’s why:

    * If you’re getting just one thing, the getter can take an optional default result value. #Python works like this in `getattr`, `.get`, and things of that nature. Having an operator for this is fine, but it seems obvious you don’t **need** the language to do it for you.
    * If you’re walking down a long uncertain chain, I have two arguments:
    * Knowing the path that leads down into the object to the specific thing you want kinda sounds like an #Encapsulation violation. Why do you know so much about the internals of this object. If this deep property is important, maybe it’s part of the interface of the top-level thing. Maybe this is just bad design.
    * Diving deeply involves lots of possibilities: possible defaults, actual methods of finding the named thing (allow inheritance? Is it an attribute? Is it an element of an array? Etc), did you want to just stop or raise an exception?Does saying what you want really come out to a simple, clean, understandable, one-line, expression?

    Maybe I’m biased because I don’t have these operators in my day-to-day language; and also can’t remember hitting this situation. And I can certainly see such operators could be helpful. I’m not a language designer. But from my actual experience, in this case, the juice just isn’t worth the squeeze.

    #NullCoalescing #NullChaining #LanguageDesign

  8. New blog post just dropped! Programming Language Design in the Era of LLMs: A Return To Mediocrity? kirancodes.me/posts/log-la... #ProgrammingLanguages #LanguageDesign #DSLs

  9. For the gophers out there... Just a reminder: a bunch of consts + iota isn't an enum. Slugs aren’t enums. Interfaces, structs, and switch statements aren’t enums either.

    Enums are enums.

    Scala went through the same BS for what felt like a gazillion years.Just add a proper enum to the language. Go really needs a proper sum type. Don’t wait until Go v3 like we did in Scala.

    "Simplicity" here is creating extraordinary levels of complexity.

    #Enums #Golang #scala #LanguageDesign

  10. Kotlin and Go couldn't be approaching their error handling pains more differently.

    Go: go.dev/blog/error-syntax
    Kotlin: medium.com/@internetcreationis

    TL;DR: While Kotlin is getting rich errors, Go is getting... nothing. And please stop asking for it, the community clearly won't come to a consensus.

    Like it or not, `if err != nil` is here to stay.

    #GoLang #Kotlin #ErrorHandling #LanguageDesign #ProgrammingLanguages #DevThoughts

  11. Finally managed to migrate `Result`'s variant naming:

    - `Pass` instead of `Ok`
    - `Fail` instead of `Err`

    #core #LanguageDesign

  12. If all languages have a hard time create integrating with c++ but an easy time integrating with c, we could consider it a design failure of the c++ language itself

    #programminglanguages #c++ #languagedesign

  13. Only a few tasks left before dropping the work-in-progress label of the "Principles of Language Design" talk. :awesome:

    soc.me/talks/language-design
    (requires browser with JXL support)

    #LanguageDesign #programming

  14. Rust calling their unchecked blocks "unsafe" is an ongoing cost that will never stop as long the language exists.

    #Rust #LanguageDesign

  15. Interesting issue I hit recently: If you combine unified condition expressions with unions, you could get code like this:

    union X of String
    let foo: X = "bar"
    if foo
    ... is String { ???.size }

    How to refer to the "casted" value of String inside the curly braces here?
    With "classic" enums it was easy, because they had an extra syntactic layer of wrapping that my unions lack.

    #LanguageDesign

  16. Is it just me, or are all the language options for building shaders some milquetoast reinterprations of 80s' C/C++?

    #gpu #shaders #LanguageDesign

  17. A module system that doesn't account for generics is also called "a draft of a module system".

    #programming #LanguageDesign

  18. Despite ample evidence to the contrary, #Ilive (hmm, if I were also #evil, that would be a pallindrome as well as a visual collision)
    Fascinating (if I do say so) #lispgames #gamejam #gamedev #retrospective on #itch_io
    lispy-gopher-show.itch.io/lisp
    I am enormously happy with the
    { verb [ dobj [ prep iobj ] ] } x
    language dynamic, and how it shares your #lisp #repl, and their concerns are just... Different so they don't collide.
    I guess I get my #languageDesign friends a little better now.
    Thoughts?