News for hackers. Stuff that matters.
Re:Programming language notation is a barrier to entry by the_af on Thursday October 01, 2020 @01:03PM (#24653390)
In this I agree with Paul Graham (and note I don't worship the guy). When talking about some lisps, he wrote [1]:

> As names, car and cdr are great: short, and just the right visual distance apart. The only argument against them is that they're not mnemonic. But (a) more mnemonic names tend to be over-specific (not all cdrs are tails), and (b) after a week of using Lisp, car and cdr mean the two halves of a cons cell, and languages should be designed for people who've used them for more than a week.

In particular, the last sentence. I find arguments that go "but this looks confusing to a beginner!" unconvincing. Language syntax and notation should be aimed at actual practitioners, not beginners.

----

[1] https://news.ycombinator.com/item?id=21256727

Re:Programming language notation is a barrier to entry by nur0n on Thursday October 01, 2020 @02:29PM (#24654468)
There was a huge discussion shortly after Julia 1.0 was released regarding scoping [1]. Beginners intuitively think of scoping in a manner different from the way scoping should work in production projects. There was a lot of tension between seasoned programmers and educators (who had to constantly interact with beginners).

The community exhausted the entire design space (along with some full-blown prototypes). Eventually, the core Julia team chose to use more forgiving scoping in the REPL (virtually always the first point of contact for beginners), while actual projects enforced stricter scoping rules.

My key take-away is to consider how the language interacts with its ecosystem, not just how it should ideally operate in isolation. I have found the Julia team to be consistent in this pursuit. If the first point of contact is intractable for beginners, the project is dead on arrival. A technical tool should be tailored for experts, but you don't want to kill adoption along the way. Engineering is tradeoffs.

This article goes more in depth along the same lines: https://pchiusano.github.io/2016-02-25/tech-adoption.html

[1] https://discourse.julialang.org/t/another-possible-solution-...

Re:Programming language notation is a barrier to entry by st1x7 on Thursday October 01, 2020 @03:13PM (#24655044)
I understand there's a larger point being made here but I wouldn't give the decision that the Julia team made about scoping as an example of how to design a language. It makes the language inconsistent and now both beginners and experienced developers have to learn an exception instead of one group having to learn a slightly novel approach to scoping.
Re:Programming language notation is a barrier to entry by google234123 on Thursday October 01, 2020 @05:51PM (#24656510)
Allowing both seems like the worst solution. Inconsistency is annoying for both beginners and professionals.
Re:Programming language notation is a barrier to entry by phkahler on Thursday October 01, 2020 @08:33PM (#24657626)
>> My key take-away is to consider how the language interacts with its ecosystem, not just how it should ideally operate in isolation.

Please please, how do we convey this to the mathematicians that infest wikipedia?

Re:Programming language notation is a barrier to entry by seg_lol on Thursday October 01, 2020 @09:33PM (#24657903)
I would love someone like gwern [0] to write an analysis of how Mathematics articles on Wikipedia start off being understandable by most and then get lapped into a submicron finish that only reflects an insular subset of folks. These mathematical nuggets sit like hard grains in mud (sorry wikipedia) that only mathematicians can understand.

And in so doing, they slowly bootstrap themselves so far away from any grounding context that it is incredibly difficult for anyone to _learn_ mathematics from reading wikipedia articles.

There are groups doing great things like Setosa [1], nLab [2] and for concepts, Simplicable [3]

[0] https://www.gwern.net/

[1] https://setosa.io/ev/

[2] https://ncatlab.org/nlab/show/HomePage

[3] https://simplicable.com/new/communication

Re:Programming language notation is a barrier to entry by mannykannot on Sunday October 04, 2020 @11:06PM (#24684195)
I had not realized that was going on, but it makes a lot of sense now you mention it.
Re:Programming language notation is a barrier to entry by lisper on Thursday October 01, 2020 @04:51PM (#24656027)
A long time ago I settled on FST and RST as the Right Names for the two halves of a cons cell. The argument is:

1. It's vaguely mnemonic of FirST and ReST, but compactified enough that it's still parseable as abstract names with no particular semantics

2. It's composable the same way that CAR and CDR are, e.g. FFRST == CAADR.

Another good pair of names is LHS and RHS for Left Hand Side and Right Hand Side. Same argument applies.

Re:Programming language notation is a barrier to entry by Riverheart on Thursday October 01, 2020 @06:50PM (#24656990)
How do you define these so you can use them like CAADR?
Re:Programming language notation is a barrier to entry by lisper on Thursday October 01, 2020 @07:22PM (#24657231)
(defun ffrst (l) (caadr l))

Lather, rinse, repeat.

For extra credit, write a macro that will save you having to type every possible combination out manually.

Re:Programming language notation is a barrier to entry by emidln on Thursday October 01, 2020 @07:26PM (#24657259)
I did this once for Clojure and named it car-cdr-construction-set! with an argument for how many levels deep to define in the current namespace.
Re:Programming language notation is a barrier to entry by agumonkey on Thursday October 01, 2020 @08:08PM (#24657492)
Some people in university hinted that some lisps had special parsing stages for car/cdr based functionals. They may turn c(.)*r into nested (car (cdr ( ... ) ) ) calls.
Re:Programming language notation is a barrier to entry by abecedarius on Thursday October 01, 2020 @02:27PM (#24654444)
I don't exactly disagree: the function names work -- but instead of those functions you could be using pattern matching. When the need for the functions is rarer, the disadvantages of that kind of name become weightier.
Re:Programming language notation is a barrier to entry by rapind on Thursday October 01, 2020 @03:47PM (#24655426)
I think different languages for different audiences. I also think that languages that are noob friendly can achieve broader appeal and greater mindshare.

For example, ruby has plenty of warts and annoyances that become evident with experience, but I still find plenty of ruby code that’s lovely to read (like it’s telling a story). Plenty of atrocities too, which is exacerbated by the language.

I see the value in succinct languages too, which require a knowledge investment to be productive. Just more efficient.

It’s kinda like QWERTY typists and stenographers, but with far more middle ground. No one can argue that stenographers are faster, but it’s also not a realistic expectation for everyone to learn it.

Re:Programming language notation is a barrier to entry by notmyname9173 on Thursday October 01, 2020 @03:08PM (#24654975)
6 months in, Agda is just as cryptic as it was on day 1.
Re:Programming language notation is a barrier to entry by the_af on Thursday October 01, 2020 @04:13PM (#24655674)
I'm not familiar with Agda, but it's entirely possible its syntax is just not good. It doesn't contradict pg's point.
Re:Programming language notation is a barrier to entry by siraben on Friday October 02, 2020 @01:20AM (#24659161)
Alternatively, instead of car and cdr one could have pattern matching, which is more declarative and less error-prone than c(a|d)+r.
Re:Programming language notation is a barrier to entry by ForHackernews on Thursday October 01, 2020 @01:19PM (#24653587)
Everyone is a beginner before they become a practitioner.

Look at Perl for an example of what happened to a language with syntax that appealed only to people who were already Perl-practitioners.

Re:Programming language notation is a barrier to entry by tzs on Thursday October 01, 2020 @01:39PM (#24653882)
> Look at Perl for an example of what happened to a language with syntax that appealed only to people who were already Perl-practitioners

It became for several years one of the most successful and widely used scripting languages on Unix?

Re:Programming language notation is a barrier to entry by sidlls on Thursday October 01, 2020 @02:16PM (#24654318)
Until languages with a different view completely left it in the dust.
Re:Programming language notation is a barrier to entry by tomc1985 on Thursday October 01, 2020 @07:41PM (#24657357)
Such is the way of the world. The same will eventually happen with what is in vogue today, and detractors will appear seemingly out of nowhere to talk shit

The idea that today's languages and technologies are truly better than the past is laughable, particularly when they recycle so much of what is old and slap on a new name

Re:Programming language notation is a barrier to entry by sidlls on Thursday October 01, 2020 @10:03PM (#24658045)
The idea that today's languages and technologies are truly better than the past is laughable,

That's really orthogonal to the discussion, though. This isn't about general superiority, it's about legibility and barriers to understanding/skill due to syntax and keywords. Perl is infamous for the "code golf is the default style" syntax, keywords, and tokens it employs in this context, and in my experience at least its most ardent fans believe it is a badge of honor.

It isn't, really, and it's the same mistake PG makes when discussing "car", "cons" and the like.

Re:Programming language notation is a barrier to entry by tomc1985 on Friday October 02, 2020 @02:05AM (#24659415)
> and in my experience at least its most ardent fans believe it is a badge of honor.

Indeed. And I disagree with your opinion. For all its terseness its still wonderfully expressive and it goes against the horrible trend set by Python with its "one true way" bullshit. That we all so willingly accept the commodification of our trade so the paymasters can eventually decrease our demand is shameful.

We should strive for a certain level of difficulty if anything to separate the wheat from the chaff. You wanna play with the big boys? Learn to code in a big boy language.

Instead we let the trainwreck that is modern JS take over.

Re:Programming language notation is a barrier to entry by sidlls on Friday October 02, 2020 @05:00PM (#24666975)
Who is "we"? And take over what? Backend web development? Hardly--that's still mostly PHP. The most sophisticated pieces of the most sophisticated internet application ("web") software are generally written in Java, C++, or Go (some Erlang, some others, etc., but mostly those). "Big boys"? What does that even mean?
Re:Programming language notation is a barrier to entry by the_af on Thursday October 01, 2020 @02:47PM (#24654682)
There are multiple reasons why that may have happened.
Re:Programming language notation is a barrier to entry by reflectiv on Thursday October 01, 2020 @04:52PM (#24656035)
and a lot of them begin with 'perl is a mess...so...'
Re:Programming language notation is a barrier to entry by RhysU on Thursday October 01, 2020 @09:59PM (#24658024)
Well, we were all told that Python was easy and, lo, so it was. And that Perl was line noise and, lo, so it was. But I still find basic Perl to make as much sense as basic Python when I put my mind to it. And both to be painful in the wrong hands.
Re:Programming language notation is a barrier to entry by the_af on Thursday October 01, 2020 @01:27PM (#24653711)
PG's point is that language syntax and notation should be aimed at practitioners. For beginners, almost anything will be a hurdle till the get the hang of it. Afterwards, they'll be practitioners. Being a beginner is a temporary situation; practitioners are forever.
Re:Programming language notation is a barrier to entry by AnimalMuppet on Thursday October 01, 2020 @01:33PM (#24653797)
At the beginning, languages have zero practitioners. To at least some degree, they have practitioners in proportion to how many non-practitioners bother trying to become practitioners. The more off-putting the syntax is to a non-practitioner, the fewer bother to try to make the leap.

Now, you are right that the syntax is for practitioners. But if it's too bizarre to non-practitioners, it is in fact a barrier to entry.

Re:Programming language notation is a barrier to entry by nickjj on Thursday October 01, 2020 @01:45PM (#24653950)
> For beginners, almost anything will be hurdle till the get the hang of it. Afterwards, they'll be practitioners. Being a beginner is a temporary situation; practitioners are forever.

What about languages who support multiple ways to do something in a semi-inconsistent manner?

For example with Elixir, in a lot of cases you end up calling certain standard library functions like foo(hello: :world) while others are foo(:hello, :world). Now, there's special magic happening in the first case but stuff like this is super confusing and it gets easily compounded with more complex examples.

As a beginner I found Ecto's various ways to calls things super confusing and I had to reference examples almost all the time to get the syntax right (which often had multiple ways of being "right"), but I've also talked with more experienced Elixir developers and they get hung up with Ecto's syntax too.

So where do you draw the line between making the language / DSL better and keeping it catered to only folks who are basically at the same skill level of the language creator?

Re:Programming language notation is a barrier to entry by wtetzner on Thursday October 01, 2020 @04:33PM (#24655893)
> What about languages who support multiple ways to do something in a semi-inconsistent manner?

But that's not really a beginner-specific problem. Even practitioners will likely find it to be a nuisance.

Re:Programming language notation is a barrier to entry by czynskee on Thursday October 01, 2020 @02:03PM (#24654161)
I had (have) the same experience with Ecto but Ecto != Elixir.

One of the super cool things about Elixir is how easy it is to extend the language with DSLs. However (and Jose et al are very up front about this), the more DSLs and macros you use, the more confusing it's going to be. Using macros is a tradeoff because it can be a very neat solution but it also obscures what the code is doing quite a bit.

Re. foo(hello: :world) vs foo(:hello, :world) - that one I got the hang of more quickly, though I'll admit it's confusing at first. In the first you're providing a keyword list (which is merely a list of 2-membered tuples where the first member of the tuple is an atom). And when a keyword list is the last (or only) argument to a function it can be provided without the brackets. So the same thing could be written as foo([{hello:, :world}]) or also foo([hello: :world]). In foo(:hello, :world) you're just providing arguments. When you're first learning the language this can definitely trip you up but I think once you become a "practitioner" it's not too bad and ends up being pretty nice.

God Elixir is so cool.

Re:Programming language notation is a barrier to entry by the_af on Thursday October 01, 2020 @02:45PM (#24654663)
> What about languages who support multiple ways to do something in a semi-inconsistent manner?

They seem like a good thing to me!

The aim is never to make things difficult for beginners on purpose. The point is that making things less confusing for beginners is not worthwhile if it comes at the cost of making things more cumbersome for practitioners.

Re:Programming language notation is a barrier to entry by the_af on Thursday October 01, 2020 @06:00PM (#24656586)
Addendum: I completely misread the comment I was replying to. My comment "they seem like a good thing to me" makes no sense. Please disregard. Unfortunately, I cannot delete it now.

I actually agree with the comment which states "But that's not really a beginner-specific problem. Even practitioners will likely find it to be a nuisance."

Re:Programming language notation is a barrier to entry by striking on Thursday October 01, 2020 @01:37PM (#24653855)
I'm pretty sure I hated writing Perl before, during, and after I was any good at it. It's unnecessarily full of ultra dense symbols, many of which are made dense for no reason. ($| means "hot pipes" means you want to flush all characters always. Set it non-zero to make it do that. Want saner names? Why don't you `use English;`, you rube?)

Sure, being a beginner is a temporary situation, but let's not excuse absurdities and unnecessary convolutions as a result.

Re:Programming language notation is a barrier to entry by the_af on Thursday October 01, 2020 @02:39PM (#24654595)
It goes implied in pg's remark, and my own opinion, that the notation must be good for practitioners. It's of course possible for notation to be plain bad for everyone.

The argument actually says "don't optimize notation for beginners, optimize for practitioners". It doesn't imply making things difficult for beginners on purpose; just that they are not the priority.

Re:Programming language notation is a barrier to entry by striking on Thursday October 01, 2020 @04:01PM (#24655572)
I understand that, I read the remark. But you were replying to a comment about Perl, and I want to make it clear that there are plenty of people and languages that make excuses in favor of practitioners when it's convenient and that they shouldn't.

I just don't even think it's a useful remark because you can just claim people you disagree with are beginners and people you agree with are practitioners and now anything can be argued.

Re:Programming language notation is a barrier to entry by the_af on Thursday October 01, 2020 @04:14PM (#24655691)
I wasn't commenting on perl, in case there's any confusion.

I wouldn't call people who disagree with me on PL design issues beginners. I would call beginners beginners. It's not a matter of disagreeing, it's a matter of experience and time working on real projects with a language.

Re:Programming language notation is a barrier to entry by agumonkey on Thursday October 01, 2020 @08:09PM (#24657496)
I'd even go further, notation should never .. well that's too radical, rarely be a topic of discussion.

Concepts are way more important. Spending time on syntax is like having a course in tar --flags.

Re:Programming language notation is a barrier to entry by mcguire on Thursday October 01, 2020 @02:39PM (#24654594)
This explains the success of APL.
Re:Programming language notation is a barrier to entry by the_af on Thursday October 01, 2020 @02:43PM (#24654638)
In case you're being snarky: it doesn't logically follow that because PL notation should optimize for practitioners, that any notation will be successful. It's possible for a notation to be bad for practitioners as well.
Re:Programming language notation is a barrier to entry by dodobirdlord on Thursday October 01, 2020 @05:48PM (#24656483)
There’s a small group of people (financial analysts, mostly) who use APL derived languages, are hugely productive and make tons of money, and have no interest in changing the language they use. Not every tool is for every purpose and not every language should try to appeal to all users.
Re:Programming language notation is a barrier to entry by Wezl on Thursday October 01, 2020 @07:11PM (#24657143)
Although many of the APL derived languages changed their syntax by removing the fancy symbols. I'm not disagreeing, though: some people like them, some don't, and that's why people use j, k, and APL.
Re:Programming language notation is a barrier to entry by imtringued on Friday October 02, 2020 @04:09AM (#24660275)
What about beginners who stay beginners?