A Scala common-style pilot study

Announcing this new study report: “Braceful, braceless, or the common style?”

The experiment was inspired by a community note by Martin Odersky, Rex Kerr and myself, proposing a common Scala style that balances braceful and braceless:

Feedback welcome here, both on the study and on the community note. Happy reading :slight_smile:

//BR

2 Likes

Here is a link back to the original discussion on the common style:

I think this is a great little study, and I really appreciate the attention paid to local models, and taking local models seriously. I also want to commend the 9. How this post was made section, in particular:

The AI is a tool, not an author. It cannot be accountable for the work, so it is not credited as an author; its role is disclosed here instead. The mistakes are mine; the useful parts are ours.

That level of taking ownership and responsibility is just very heartening to see. Really good writeup.

On an intuitive-mechanics-of-why-and-somewhat-reductionist analysis, I think the results and outcome that common style would work best for the machines since the proposed common style is sort of the ‘lenient’ style - in the common-style-world where both braces and whitespace are valid, it can output either and still be compiled, and a brute force rewrite (“let me try with braces, oh it didn’t work, let me try and remove it”) is likely to succeed in making something compilable. We could hypothesise whether that also means people are more likely to have ‘success’ with the language early on because whatever paradigm they’re used to will work, maybe that’s the selling point - “write it your way, scala won’t get in your way ™️” or something like that.

Since the current models are trained on a mixture of both brace and braceless .scala files since Scala 3, it can/could output any ‘chunk’ of code in braceless/braceful style. I think if python introduced a scala-lookalike-common style now with braces, LLMs would struggle with it since it has zero training data from python in that style (… apart from of course this classic repo which I think is satire (?) ) - so whether common style divorced from scala is better for LLMs/token-usage, or common style is better specifically because of the mixed training data is probably nearly impossible to ever quite figure out.

1 Like

Many thanks for you feedback and thoughts. Thanks for supporting that view of agent accountability; I think it is esp. important to take that stance these days when the Claude logo is all over the place esp in commits (which I view more or less like a marketing stunt) …

And I hadn’t really though that much about the training aspect in relation to the common Scala style so I should weave that into further studies when I get time/tokens :slight_smile:

1 Like

(And I guess you are right about the irony of bython; it at least does not seem to have taken ------- and last commit is 8 years ago… Maybe an agent can help revive the project? :slight_smile: )

PS. The superlooong emdash is purely human.

Regarding the accountability: Thanks to agent, while giving it a cue to help me with my broken English to look up a translation of the Swedish word “äkta”, a couple of days ago I learned about this actual English word (lent from German): echt

I think that word embodies what we are trying to do with agents, work together with them to invent great software, while being echt, in the sense that we must not get fooled by hallucinations or lured into confabulation (*), but always check it in a way external to the agent. (And to the human; we confabulate sometimes too, as you know…)

(*) according to M&W:

  • confabulate = to fill in gaps in memory by fabrication