Live data from Hacker News

Polyglot programming and the benefits of mastering several languages

stxnext.com

41–50 of 68 posts

Re: Polyglot programming and the benefits of mastering several languages

#41
post #34
post #8

Earlier quoted context omitted.

since languages seem so easy to pickup. What takes time is being productive with the APIs and ecosystem, not learning the language.

Or learning the underlying programming paradigm. Even if Haskell used a Python-like syntax, I bet people would still find it 90% as hard to learn as they do now, due to the killer combination of lazy evaluation and purely-functional design.

Yep. People often point at syntax and say "yuk!" but the problem is really not groking semantics. Syntax is just easy to bikeshed.

Re: Polyglot programming and the benefits of mastering several languages

#42
I generally enjoy picking up new languages. It's always a chance to see how other language designers worked around common programming tasks. It's also great because you get exposed to an entire set of tools that may be unfamiliar to you.

I'm a fan of polyglots.

Re: Polyglot programming and the benefits of mastering several languages

#43
The languages I'm using now are Ruby, Python, Elixir, JavaScript. Languages I was proficient into and I kind of let go are Java, C, Visual Basic, Perl. Maybe I should count some BASIC from the 80s too. Then there are a number of other languages I used for some time (PHP, even COBOL) but never become really an expert.

The pros:

I reuse some approaches that work well in some languages, unless they are definitely not idiomatic.

I keep my code idiomatic but simple because I don't have time to go into a language deep rabbit holes (eg: we usually don't need any metaprogramming.)

I can instantly smell bad design in some features because they remember me of the pitfalls of those parts of the languages I'm familiar with. Hint: moving the separator to the opposite end of Python's join / split is a bad idea, I never remember if "," splits or joins. Pick a direction and stick to it, a-la Ruby. After all, if ",".join(["a", "b"]) why not ",".split("a,b") ? Of course as I'm not a language designer this doesn't give me any advantage. Actually, I lose time thinking about it.

I can pick contracts for more projects because there are more chances that my potential customer has invested in one of the languages I know.

The cons:

I long for structural pattern matching a-la Elixir in every languages, not the glorified switch/case or the destructuring assignment that many languages are adding now.

I spend time to look for basic things like how to convert a string to lowercase because every language does it differently and I can't remember it. Is it necessary to be smart with those little things? Apparently yes so they go with downcase(), lower(), toLowerCase(), tolower(), lc() in random historical order. At least some languages copied other (Elixir from Ruby, JavaScript from Java.)

Re: Polyglot programming and the benefits of mastering several languages

#44
post #34

Earlier quoted context omitted.

Or learning the underlying programming paradigm. Even if Haskell used a Python-like syntax, I bet people would still find it 90% as hard to learn as they do now, due to the killer combination of lazy evaluation and purely-functional design.

Yep. People often point at syntax and say "yuk!" but the problem is really not groking semantics. Syntax is just easy to bikeshed.

Thank you for clarifying my point, and attaching precise terminology to it!

Come to think of it, that's probably why people mistakenly think that Lisps are so hard. The syntax is scary, and easy to bikeshed - even though most of their semantics (for CL and Scheme, at least) are really easy, and very similar to Python.

Re: Polyglot programming and the benefits of mastering several languages

#45
What I love about systems like bazel, buck, etc. is that they tend to be language-agnostic, or maybe more like language accepting, unlike the new trend where each new language, comes their own build system: rust, go, dart/flutter, zig, etc... so good luck trying to explain dependencies from one to another... I simply wish the build process was not so entangled in the language itself.

Re: Polyglot programming and the benefits of mastering several languages

#46

As I master my 15th or so language, I can't help noticing how often I have to search online for the simplest of tasks whenever I switch languages now because it's all turned into a big jumble. Does it need parentheses or not? How are closure variables managed? Do I need to release things? Do lambdas require scoping braces or not? What's the damn syntax for them again??? Do I need to use case(X), switch(X), when(X), s…

I know people hate language wars and always reply with “Use the best language for the job.” but wouldn’t it be great if there was a language that could do it all optimally (or at least adequately).

Then we can focus on just one language to master and don’t have to keep in our heads a jumble of languages.

Re: Polyglot programming and the benefits of mastering several languages

#47
post #21

Earlier quoted context omitted.

Ruby is in the post-hype phase.

Right, but my point is adoption and hype don't always go hand-in-hand. JavaScript for example has always had heavy adoption but now is going through a hype phase. Ruby had a hype phase a decade ago but only now is seeing heavy adoption. Similarly PHP hype peaked in the early 00s, but adoption didn't peak until ~2017 and is now beginning to decline. Rust is seeing heavy hype that will probably be followed in 5-10 year…

I'm not sure that there are as many problems to solve for languages like Rust and Go as there are for languages like PHP and JS, Ruby or Python. Basically desktop/system vs web apps. Of course we can write web apps with Rust and Go and we do but why bother? There is evidence that the world is using PHP to write web apps, not the new (and better) languages of the last few years. It's so much easier.

Java is somewhat in the middle: a compiled language heavily used for web apps. There was little else to use in the 90s, except Perl, so big Java shops got established, banks started using it and it will live at least as long as COBOL. But do I want to write web apps with Java? No thank you, I jumped ship to Ruby 15 years ago, then added Python and Node.

Re: Polyglot programming and the benefits of mastering several languages

#48
> Fascinated by the concept of polyglot programming, I decided to make good use of the fact that I know several exceptionally experienced developers and take a closer look at the topic.

The author selected only “polyglot” programmers so of course they would sing its praises. Or did the author expect them to say, “well I have experience with these 15 different frameworks, but I’d say 12 of them were a waste of time... meh.” You might make an off-hand comment on that on HN, but you typically won’t do that when you are being interviewed because of your seniority or whatever. That’s like downplaying things on your résumé.

Not that I personally think that being a “polyglot” is bad. But we need to distinguish between two things:

1. Mastering a wide breadth of programming ideas expressed through different languages 2. Knowing or having experience with implementing a lot of stuff

(2) might simply require being a polyglot because different domains and different fields use different languages. But (2) does not imply (1): you might have experience with eight different programming languages that are very much alike (only really differeing in third party libraries, perhaps), so you haven’t really gotten the chance to be a “polyglot” in the multiple paradigms sense of the word.

Re: Polyglot programming and the benefits of mastering several languages

#49

As I master my 15th or so language, I can't help noticing how often I have to search online for the simplest of tasks whenever I switch languages now because it's all turned into a big jumble. Does it need parentheses or not? How are closure variables managed? Do I need to release things? Do lambdas require scoping braces or not? What's the damn syntax for them again??? Do I need to use case(X), switch(X), when(X), s…

I know people hate language wars and always reply with “Use the best language for the job.” but wouldn’t it be great if there was a language that could do it all optimally (or at least adequately). Then we can focus on just one language to master and don’t have to keep in our heads a jumble of languages.

We already have that language but people keeping getting whiny about parentheses, and refuse to use it.

Re: Polyglot programming and the benefits of mastering several languages

#50

As I master my 15th or so language, I can't help noticing how often I have to search online for the simplest of tasks whenever I switch languages now because it's all turned into a big jumble. Does it need parentheses or not? How are closure variables managed? Do I need to release things? Do lambdas require scoping braces or not? What's the damn syntax for them again??? Do I need to use case(X), switch(X), when(X), s…

I know people hate language wars and always reply with “Use the best language for the job.” but wouldn’t it be great if there was a language that could do it all optimally (or at least adequately). Then we can focus on just one language to master and don’t have to keep in our heads a jumble of languages.

Basically any modern, turing-complete, and non-esoteric (eg. Brainfuck) language fulfills the "at least adequately" part. So it comes down largely to preference and style of the language itself. I can't stand C# code or that the language uses Allman style over K&R because I truly find Allman style more difficult to read. I shouldn't - the difference is very minor - and although I work with a C# codebase in my day-to-day work I always struggle parsing the code quickly compared to languages where K&R style won out.

Now "optimally" is an entire can of worms because there are some aspects where you need to make mutually exclusive choices. You can optimize A or B but not A and B for multiple sets of A and B. So you'll end up with multiple languages or multiple flavors of a single language where decisions were made to optimize for varying sets of A and B. A and B can even be simple things like "How easy is it to footgun yourself?". Should you make code that is more boilerplate/difficult to write in order to prevent people from footgunning themselves or do you expect your developers to be more experienced and allow them to write more succinct code but having to be aware of and avoid potential footguns themselves? There are a lot of domain-specific languages for precisely the kinds of trade-offs are made that certain fields want/need. For example, mathematics domain languages tend to be 1-indexed instead of 0-indexed.

By the way that language is LISP.

[0] Just in case anyone is unfamiliar with Allman/K&R styles mentioned you can see examples on Wikipedia: https://en.wikipedia.org/wiki/Indentation_style

Post reply on HN