@jrose I'm fairly certain the majority of people don't actually read linearly word-by-word.
Why do I think this?
When I took drama lessons the amount of times our teacher told us "no that's not what's written" and multiple of us needed to go back and actually parse the words in a sentence to realise that we either added, omitted or straight up swapped a word compared to what's written is staggering.
Our brains try to optimise everything, including reading.
@jrose I am surprised that anybody can read non-trivial code linearly! Especially in OO-languages, where I would be helpless without cross-referencing. "Remind me again what a FnorbFactoryFactory does?". Or, "who is calling this crap, and why?".
I have all related keystrokes firmly committed to motor memory.
@joe @pcbeard @jrose i assumed sigils were type specifiers for the symbol and not coercion operators for quite a while. one difficulty i have is with good ideas that don't support user extension without forking the language (scala's unapply operation for extensible case matching was an epiphany to me).
if you go far enough with this you may eventually arrive at a stable HIR which makes the choice of concrete syntax an explicit decision. curiously scala 3 has this and in private tooling devs say it is terrible to write against compared to odersky's former protege eugene burmako's semanticdb. it does indeed allow the scala compiler itself to support multiple forms of concrete syntax but if the compiler is to take upon the role of tooling, it would be wise to separate this phase.
in the same way, the compiler should not integrate linear path traversal for library search into the rest of compilation (and certainly not for interpreters), but instead make this its own distinct phase generating an explicit mapping, which tooling can override. this is a general mechanism that can be observed for any command-line tool, where cli parsing tends to produce a serializable configuration that could alternately be deserialized as an explicit preprocessing phase.
i used to think a macro API was the key to multiple concrete syntaxes, but a macro API is itself a syntax, and i don't actually like most macro APIs (elisp has a destructuring one developed by a haskeller maintainer i do quite like). generating source code is also a sort of macro API, which is what coffeescript does. so if the language wants to do better than generating source code, it may as well entirely decouple source code from input.
arguably, this would seem to disparage syntax, and the value of language designers in crafting syntax like wall does. i believe that the design and craft of syntax is harmed when it runs into petty squabbles, or (more commonly) when it stops users from immediately upgrading to new versions. i also don't think a change in semantics should be signalled through a parsing error.
@jrose I remember the first time I read
for (;i<=n;++i) {
It didn’t parse in my brain yet. C was still new to me. But it grew on me.
@jrose I've been thinking about this, or something related, in the context of SQL—a language that largely favors keywords over punctuation—which I habitually write in the classic SELECT foo FROM bar WHERE baz style, and which some of my colleagues write in all lowercase.
The difference, I think, is syntax highlighting, which they all learned with and take for granted. The uppercase keywords originally made up for the lack of that.
@boredzo @jrose “why are the old people always shouting at the database?”
I think you especially have a point for the multi-decade gap between syntax highlighting being available and it being something you could count on having on a remote terminal session, query tool not oriented at developers, etc.
@acdha @boredzo @jrose haha yeah we actually went and mandated capitalized keywords for SQL in the style guide at work, and the young people have been willing to go along with it, for which we thank them (we must have established trust somehow....)
but we gave a lot of thought to whether it was the right thing to do
@jrose ohhhhhhh
right, okay. that makes sense