Hacker News new | ask | show | jobs
by alekratz 1185 days ago
I am begging these language designers to show me what your language looks like right off the bat. It should be the first thing I see on your language's homepage. I shouldn't have to click through vaguely-named pages to see single-line snippets. Show me a full program!
4 comments

Hope they will add this link on the site: https://github.com/IoLanguage/io/tree/master/samples/misc
Thanks for the suggestion. I've added a first pass at samples page and a link on the main page. https://iolanguage.org/samples/
Even that's one click too far away.

Think of it like how the expectation for apps is that there'll be a screenshot (or video!) on the homepage of the app doing its job — i.e. of the user experience of the app.

The first thing you should shove in my face, when I land on the home page of a programming language, is the user experience of writing code in the language. Which is to say: the syntax.

But also, if your language has a REPL, or an IDE, or a weird graphical virtual machine like Smalltalk, then that's part of the language's UX as well — so show that too! (And if you can, integrate the two together. Show me a cohesive example of what the syntax looks like inside the REPL/IDE.)

Language home-pages doing this right: https://www.ruby-lang.org/en/ , https://elixir-lang.org/ , https://www.python.org/ , https://www.haskell.org/ , https://nim-lang.org/

Language home-pages that get a B+, for putting the example on the homepage, but below the fold: https://go.dev/ , https://crystal-lang.org/

Everybody else (Rust, PHP, Java, Lua, etc.) gets an eyebrow raised in suspicion, because their home-pages feel like they're ashamed of what their syntax looks like :)

That might be contentious. I don't care at all what the syntax is, I want to know what choices have been made in the language design space, and if they look reasonable/interesting, how sound the implementation looks. The top level about link followed by source was ideal for that. Only after sanity checking the implementation source would I look for some example of what the language looks like.

On the other hand, language A but looks like language B is definitely a thing and I suppose those should put syntax front and center as it's their selling point.

> I don't care at all what the syntax is

I'm pretty sure, if the user experience of coding in a language is bad enough, that you wouldn't use said language, no matter how interesting it is design-wise. There's a threshold below which most programmers would rather reimplement the cool design features in a different language with better syntax than use the original language.

Does anyone write in APL? No; it's basically impossible, given the syntax requires characters that aren't on your keyboard. But maybe you write in J. Or, more likely, you use a vector-operations/dataframe library in some arbitrary language.

Do people write in Erlang? Well, some do; but many others think that connecting expressions with semicolons and commas is too painful to want to deal with (though not me; I enjoy "systems Prolog.") And some of those people got together to design Elixir, so they could use the Erlang runtime without having to write Erlang.

Does anyone voluntarily pick up IBM JCL these days? Or COBOL? RPG? MUMPS? These archaic 1970s languages all have interesting design choices — heck, MUMPS assumes a database as part of the language runtime! — but they're just too awful to actually write in. It's far easier to just read about these languages as historical artefacts, and then implement their good ideas into a new language, than to actually use them.

Does anyone use FORTRAN? Well, yes, if they have to, to extend OpenBLAS with something. But mostly as little as possible. And there are fewer reasons to do so these days, with e.g. cuBLAS not being written in FORTRAN.

You put a syntax example on the home-page not to impress people with how cool your language looks; but rather, to show that you're not trying to bait-and-switch a prospective developer, by talking them into using a language by describing its cool features, only to reveal at the last moment that the syntax is awful.

Probably best to have a monospaced font for the samples. A non-monospace font for code just feels... weird
Yeah, good idea. I've updated it.
I think this is pretty close to Smalltalk from before classes were added. Is that basically right? Syntax looks simpler and there's the same slightly off-putting "macros aren't necessary because our syntax is flexible" sentiment.
That might be right, but I'm not familiar enough with early Smalltalk to say. Self was a bigger inspiration than Smalltalk.
Thanks! The inheritance model is definitely from Self. I'm having some trouble finding the compiler/jit infra in the github repo, would be really interested to see if you've gone down the same dynamic optimisation path Self did
Typo: The Ackermann function is misspelled as “Ackerman”.
Fixed, thanks!
I think Ruby [1] does a great job of this, making code snippets front and center.

I think the worst way to do it would be to use 13px Times New Roman text with no syntax highlighting on a secondary page. But that's what Io went with [2].

[1] https://www.ruby-lang.org/en/

[2] https://iolanguage.org/samples/index.html

It's a good point you have .. I've looked up Io over the years and funnily it did use to show the code on the homepage: https://web.archive.org/web/20100923042106/http://www.iolang...
While the need for a small example is understandable, the flipside is that it also facilitates shallow dismissal.