3 ms·
> when they're generally thought to be the cleanest syntaxes That might be true for academics. But most engineers don't consider ML syntax to be the cleanest,
by The_Colonel 2y ago
> when they're generally thought to be the cleanest syntaxes
That might be true for academics. But most engineers don't consider ML syntax to be the cleanest, since most don't know any ML language.
- wyager 2y ago> most engineers don't consider ML syntax to be the cleanest, since most don't know any ML language. This is like saying "most uncontacted Amazonian tribes don't like Shakespeare, because they've never read it". Sure, but why would we care about their opinion on this topic?
- unscaled 2y agoThey might think Shakespeare's story are silly even if they did read it. In fact, there is at least one widely publicized instance where exactly the same thing happened with a culture that wasn't exposed to Shakespeare before: https://law.ubalt.edu/downloads/law_downloads/IRC_Shakespeare_in_the_Bush.pdf https://law.ubalt.edu/downloads/law_downloads/IRC_Shakespear... The same idea is probably true with programmers who have grown used to C-like syntax or even Python-like or Ruby-like syntax. Syntax is at least in great part a cultural thing and your "cultural background" can affect your judgement in many cases: 1. Are braces good? Some programmers find them noisy and distracting and prefer end keywords or significant whitespace, but other programmers like the regularity and simplicity of marking all code blocks with braces. 2. Should the syntax strive for terseness or verbosity? Or perhaps try to keep a middle ground? At one end of the spectrum, Java is extremely verbose, but a lot of Java engineers (who have generally been exposed to at least one less-verbose language) are perfectly OK with it. The trick is that the main way that code gets typed in Java used to be copy-paste or IDE code generation (and nowadays with LLMs typing verbose code is even easier) and reading and navigating the code is done with the help of an IDE, so a lot of the effects of having a verbose language are mitigated. Diffs are harder to review, but in the Enterprise app world, which is Java's bread and butter, code reviews are more of a rubber stamp (if they are done at all). 3. Lisp-like S-expression syntax is also highly controversial. Many people who are introduced with it hate it with passion, mostly because the most important syntax feature (the parentheses) is repeated so often that it can be hard to read, but advocates extol the amazing expressive power, where the same syntax can be use to express code and data and "a DSL" is basically just normal code.
- johnisgood 2y agoI think Ada's verbosity is one of its strengths. Cannot say the same for Java, however.
- naasking 2y agoThere's "verbosity as descriptive clarity", and there's verbosity as in "I already said this, why do I have to repeat myself?" Ada unfortunately still has some of the latter, otherwise I would agree.
- johnisgood 2y agoI mean, it is supposed to be verbose for descriptive clarity.
- speed_spread 2y agoJava is really not that verbose if steer out of the 25+ years old conventions that were defined to justify expensive proprietary tooling. Leave all fields package scope or public final, so you don't need getters and setters. On JDK21+ use records and pattern matching. Go procedural + lambda, don't be afraid to use static methods. When OO is required, prefer composition over inheritance. Adopt a proper annotation processor library such as autovalue to eliminate remaining boilerplate.
- bmitc 2y agoMLs aren't really academic languages aside from Standard ML. F# and OCaml are very pragmatic languages. The cleaner parts of Rust came from ML. What syntaxes do engineers find clean? I don't understand the distinction you're making.
- t-writescode 2y agoI assume they mean: * Python, Ruby, C#, Java, Go-style languages? I imagine most developers operate in neither ML languages nor Lisp-style languages. The most advanced "FP" trick that I imagine most developers use is Fluent-style programming with a whole bunch of their language's equivalent of: variable .map do ... end .map do ... end .flatten Addendum: or maybe Linq in C# Addendum 2: And even the fluent-style trick in those languages tends to follow a similar pattern. Using Kotlin and Ruby as examples, since those are my (edit: main) languages, variable .map do |i| something_with(i) end .map { |i| something_else(i) } .flatten shows familiar tricks. The dot operator implies that the thing previous to it has an action being done; and curly braces or the "do" operation both imply a block of some sort, and so a quick glance is easy to follow. In Kotlin, this gets a little bit more confusing (yes, really) because it's common to see: variable .map { somethingWith(it) } .map { somethingElse(it) } .flatten() And now there's this magic "it" variable, but that's easy enough to guess from, especially with syntax highlighting. Anything more advanced than that and the cognitive load for these language starts to rise for people that aren't deep in them. When you're starting working with a new language, that does increase difficulty and may even be so much of a barrier that developers may not want to hop over.
- skydhash 2y agoWhen you start working in a new language, the best thing to do is to get a book and familiarize yourself with any constructs or patterns you are not familiar with. Expecting things to be similar to what you’re used to (which lower the learning curve) is a fool’s errand.
- t-writescode 2y ago