Hacker Newsnew | past | comments | ask | show | jobs | submit | dmit's commentslogin

Alt opinion: syntax is the least important part of a programming language. I can't wait for the day someone invents one where it's defined entirely as an AST (with the S standing for Semantic). Just bring your own weird syntax.

I guess Unison is the closest to this platonic ideal right now? https://github.com/unisonweb/unison/issues/499


I have an idea, maybe we could represent that AST as parenthesis.

That's cool, but I might prefer semantic whitespace. Sure would be neat if we could both work with the same code in our preferred forms.


Ah yes, now there is a LISP I can get behind!

Honestly, we can do better than LISPs.

Just use curly brackets and boom. LISP 3k.

You're welcome.


It can even be used to represent serialized objects...

Love this take! Unison is exactly this, and it's awesome!

Here's a quote from one of the creators:

> But here's the super cool thing about our language! Since we don't store your code in a text/source code representation, and instead as a typechecked AST, we have the freedom to change the surface syntax of the language very easily, which is something we've done several times in the past. We have this unique possibility that other languages don't have, in that we could have more than one "surface syntax" for the language. We could have our current syntax, but also a javascript-like syntax, or a python-like syntax.

https://news.ycombinator.com/item?id=46053304


Can Raku do something like this? I was lightly exploring it recently, and I thought I saw that something like this may be possible with it.

I'm not super familiar with Raku, but if RakuAST is what you had in mind it looks a bit different:

    use experimental :rakuast;
    
    my $ast = RakuAST::Call::Name.new(
      name => RakuAST::Name.from-identifier("say"),
      args => RakuAST::ArgList.new(
        RakuAST::StrLiteral.new("Hello world")
      )
    );
Looks more like "low-level programming an AST" (which I believe other languages offer as well), rather than using a bidirectional transform. I don't know how you'd get Raku code back out, for example.

Edit: I should have looked deeper, `DEPARSE` does exactly this:

https://docs.raku.org/type/RakuAST

Neat!


It also goes from source code to AST:

  $ raku -e 'say Q|say "Hello World!"|.AST'
  RakuAST::StatementList.new(
    RakuAST::Statement::Expression.new(
      expression => RakuAST::Call::Name::WithoutParentheses.new(
        name => RakuAST::Name.from-identifier("say"),
        args => RakuAST::ArgList.new(
          RakuAST::QuotedString.new(
            segments   => (
              RakuAST::StrLiteral.new("Hello World!"),
            )
          )
        )
      )
    )
  )

thanks, all.

I completely agree: If it is ugly-as-sin-but-useful I will learn it.

The aesthetic of mathematics as it appears in journals is I think questionable, but undeniably convenient for communication, so it is every language making the case that you (dear reader) can say something very complicated and useful in the ideal amount of space.

"Hello world" isn't that: That's the one program everyone should be able to write correctly, 100% of the time. That's how we can talk about brainfuck as exercise, but APL is serious.

Or put another way, even if seeing a new kind of "hello world" excites dear reader, it's probably not going to excite me, unless it's objectively disgusting.

What Om does here is exactly right for me: It tells me what it is, and makes it easy for me to drill down to each of those things to figure out what the author means by that, and decide if I am convinced.

I mean, that's the point right? I'm here trying to learn something new and that requires I allow myself to be convinced, and since "hello world" is table-stakes, seeing it can only slow my ability to be convinced.


This is a Very Bad Idea. Two people working with the same language will be unable to reason about each other's code, because it requires understanding their bespoke syntax and its nuances.

No it won't? That's exactly the point -- each of those people will be viewing the code in their own preferred syntax. If there is semantic nuance in the writer's syntax, the reader will see it presented in the best way their preferred syntax's representation can provide.

Imagine all the hours saved that are currently spent on tired tabs vs spaces debates, or manicuring .prettierrc, etc etc. The color of the bike shed might matter (sometimes a lot) to some people, I know, but it's storing bikes away from the elements and thieves that is the goal, not obsessing over optimizing something that is demonstrably a subjective matter of taste.


Those are both formatting examples though? You're suggesting totally different syntaxes, which means you can't even point to the same line in a codebase when talking about a PR. This throws up massive hurdles around communication when you could just agree on one standard and move on.

  class Bean {
    private boolean sprouted;

    public void sprout() {
      this.sprouted = true;
      // ...
    }
  }
or

  data Bean = Dormant | Sprouted
  
  sprout :: Bean -> Bean
  sprout Dormant = Sprouted
  sprout Sprouted = -- aw, beans, we could have modeled
                    -- this state as impossible to construct,
                    -- but you chose runtime checks, so
                    -- here we are.
As for pointing to the source line, I think JavaScript people solved that one for us with source maps. Just because we download and execute a single 4Mb line of minified code, doesn't mean we can't tell which line of the original source caused the error. :)

Oh lord, yeah this convinces me even more that this is a bad idea. I can't even tell at a glance if those do the same thing. Just pick one and move on, you're requiring everyone to pass around sourcemaps literally everywhere they go, one for every single pair of syntaxes. You can't even talk about the code with the same language with each other. Is Bean a "class" or a "datatype"? If I'm using one syntax, how do I tell you to fix a bug in your syntax?

> If I'm using one syntax, how do I tell you to fix a bug in your syntax?

How about "Hey, your Bean ain't sprouting"? :)

I'm sorry, I feel like I'm not communicating this properly. Um, have you ever discussed with someone a book or a TV show that was translated into your language? Did you have problems referring to the exact parts you liked or disliked? :)


I mean, as someone who grew up pronouncing it "Ess-Cue-Ell", I wish I learned earlier on that "Sequel" was the intended pronunciation. :)

Yes, in Ukrainian/Russian PRQL can be easily read as "prikol" (joke/gag/quirk). But I guess the best name would be "perkele" (emotional, like "damn") in Finnish.

I always used ess-cue-ell to refer to the language, and sequel to refer to the Microsoft product. It would never occur to me to pronounce the Open Source alternative as postgressequel either, that's also invariably called post-gress-cue-ell here.

Nobody calls it sequel in my country.

Even people who know because then they have to explain it which wastes time for no benefit.


Which is my point. A better name wouldn’t have had that problem. How could you ever know how it’s pronounced if you bump into it on a blog or social media post instead of the official website? We don’t write “SQL (pronounced “sequel”)” every time, we just write “SQL”.

But even then, it makes sense to choose to pronounce it “the wrong way”. I say “sequelite” because that’s fairly clear in context, but “sequel” might not be so I pronounce each letter in that case.

Did know PNG is supposed to be pronounced “ping”? I don’t know anyone who chooses to do that, even if they know.


I pronounce PNG "ping". Also JPEG as "jay peg" but, counter to the creator's intention, GIF with a hard "g".

My favorite answer to the GIF pronunciation debate is to prefer the Old English pronunciation from back before the noun "gift" picked up that extra consonant at the end, which Old English pronounced it rather like "hyeef". (Similar to what a "g" will do in some latinx dialects.) That pronunciation splits the difference and makes some of both hard and soft "g" proponents angry, which is to say that pronunciation is also a gift from the past.

SQL's terrible name is IBM's fault for multiple reasons. They were going to spell it Sequel but IBM's lawyers found another company had a trademark on Sequel and forced them to rename it to avoid lawsuits. Rather than pick a new, more original name they instead shrunk the acronym and then IBM's legal also made them tell people to spell it out instead of call it "sequel" to continue to avoid the other company's trademark. So IBM made sure the name and its pronunciation was always a mixed message from very early in the language's history. Thanks, IBM

(I've always pronounced PNG "ping". It's interesting that there is a split there, I'm not sure I would have expected a large one.)


I continue to pronounce it S-Q-L... and G-U-I; generally I pronounce most things as initialism and I'm right to do so.

Good call, for bad reasons.

> At ZML, we are creating exciting AI produ[...]


A wrapper over what?? Bun includes the JavaScriptCore engine for JS evaluation, but it's so much more.

As for financial database concerns, if you're serious about including a project like that in your system, you have thorough correctness and performance testing stages before you commit to it. And once it passes the hurdles, at that point what difference does it make if it's written in a beta language, or a bunch of shell scripts in a trench coat, or whatever.


> Jokes aside

Ok ok, good

> once Jai comes out

Dangit! You couldn't even make it to the end of the sentence.


> In a similar project, a hard part was filtering penis and nazi symbols.

Check out how the precursor of this project did it! https://news.ycombinator.com/item?id=44719222

> I built a basic CNN trained against penises and swastikas, and then anything that doesn't hit the 63% confidence score gets sent to a mod queue, a vibe-coded fish-tinder (https://bsky.app/profile/bigass.bsky.social/post/3luvikxn3f2...).



Going 1.0 was a requirement for cashing out, don't worry about it. And segfaults don't really even matter as long as you run the code in production with -OReleaseSafe and turn on ubsan, it's fiiiiineee


Think you answered your second question with your first.


Yes. It occupies the spot in the Sway tutorials that recommend you "waybar, fuzzel, tofi, [etc]" to fill out the necessities. Noctalia, DMS, and other Quickshell projects cover that void.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: