But to answer the question... to get to a place where I can contribute meaningfully to a project? Depends on the language, but I was dropped into a PHP / Python shop once after doing nothing but Java and C++ for the preceding 10 years or so, and I was contributing both PHP and Python code in a few days. But if you were to drop me into a Haskell or CL shop, I have a feeling it would take a bit longer.
Not sure I can actually point to a single language that I have mastered (except maybe Visual Basic).
I enjoy several language now, but often can't remember syntax for any of them. I think that's the thing that fades as you learn multiple languages - syntax. I know when I should use a loop, I struggle to remember how to implement a loop.
But that's the comfort that comes with the experience. I can afford to forget individual moments in time, because I know I can spin back up very quickly, if need be. It just has its comically absurd moments at the very beginning of the spinning.
I've learned to stop quantifying my learning as the "gotta get it all" mentality, because "what do I need to learn to solve today's problems" has a pretty good streak going.
C# has built-in facilities to call C++ code in a managed sense. C# doesn't do pointers the same way C does, so all of the low level minutae to pull that off is a very powerful feature.
There are even some microcontrollers whose architecture doesnt support function pointers very well, ao just doing vanilla C stuff is essentially hardware limited.
Things that make it take longer.
UI heavy tasks
Anything that requires heavy customization of large framework.
Usually in a month I can come up to speed where I'm contributing to an existing project, without doing any heavy framework customization. 6 months until I feel like I can handle pretty much any task, just need a little more time than an expert. And after a year I can probably do most things quickly.
Fluency? Months. Its usually not just the language but the whole ecosystem you need to learn.
It takes me much less effort to get back in after that compared to the first time but there usually is some start-up effort required.
Programming you never forget, but the nitty gritty details of language and library implementations are so hard to remember because each language insists on doing their own thing just subtly different from the rest. Languages that are totally alien to the mainstream are much easier in this respect.
But even after decades in some languages I would probably look like a total newbie the first couple of days having to look up commonly used function parameter orderings or record members.
If it takes 'decades', you might as well give up now, if you're considering a job opportunity that uses a different language than the one you're used to.
"A lifetime" is not a helpful response in what an honest question like this, because usually everyone realizes that full mastery on the level of compiler implementer is not what is implied by such a question .
Did you miss the part "to a level where you can start contributing to a project with it?" In OPs question?
Is that really decades?
Even now people are asking me almost on a daily basis to post a bunch of python code that I wrote and I'm probably not going to do it even though I fully intended to because - to me - it looks like crap, and I lack the time to make it better.
A couple of extra notes: I'm 'old school', never found an IDE that I liked and tend to memorize everything. This takes a long time. A typical library is a couple of tens to 100's of functions and getting to know such a library (or API, for that matter) takes time as well. Which makes me totally unsuited for certain kinds of programming, the kind where the eco-system moves faster than I can keep up with it.
I think you are the one being incredibly uncharitable. Here is the question:
"how long do you find it takes you to learn"
This is his answer for how long it takes him to feel he has adequate mastery. Perhaps he should have refrained from using the word "you" a few times, but it is not common in English to say "one," so you is often used to mean "people generally" rather than "You in specific, the person I am currently addressing."
It often causes problems in online communication and I have had my head handed to me over using the generic you on quite a few occasions, which is an incredibly uncharitable reading that usually gives me the impression the person was basically looking for an excuse to attack me personally for some reason. (This was years ago on a list where that kind of nonsense was quite common. I don't specifically recall it happening to me on HN, in part because I have worked at avoiding the generic you in any instance where someone might use it as an excuse to rake me over the coals).
You can spend the rest of the day wondering (privately, to yourself) if he is merely neurotic or if he has some kind of learning disability or if he has wisdom of experience that perhaps others should learn from (or all of the above -- none of them precludes the others). But that's completely different from assuming his answer is being given in bad faith.
There are other answers here that say some variation of the same thing -- that real mastery takes quite a long time. I don't see any reason why this answer should be singled out for being criticized in this way -- other than the fact that jacquesm is very high on the leaderboard and this position makes him a target of gratuitous nonsense of this sort.
A language like Haskell or Rust might take much longer to master depending on where you are coming from.
When I was an undergrad, we had a "language of the week"-style PL class. It seemed like an easy 4.0 given the languages they covered (mid-90s, so it was Smalltalk, Prolog, Lisp, SML, and a few more I can't recall).
I'm always suspect of people who measure programming skill by the number of languages you/they know. This tells me that they find it hard to pick up new languages and therefore don't really understand the concepts that underlie all programming languages.
Here's how to pick up a new language:
1) Locate and learn to use the documentation and toolchain.
2) Learn and understand any new concepts the language depends on.
3) Learn 90% of the syntax well.
4) Use it to write something nontrivial that you are interested in.
Notice I did not mention anything about learning the libraries. There's little value in memorizing something you can lookup quickly.
To learn languages quickly, I think the best way is by learning the 'building blocks' languages are composed from. How are function arguments passed (value vs reference), how is memory management handled (garbage collected, reference counted, manual?). Learning these lower level language concepts then allows a person to approach a new language by saying "How does this new language X handle concept Y?"
I think the scale of contribution is a much bigger differentiator though. At one end is a trivial bug fix - tweaking a string, changing an option passed to a method, something like that. I'd say usually under an hour for that, unless the language is very difficult indeed. A little inspection of the code around it plus programmer common sense and a few Google searches will usually tell you what you need to know. Things get harder the bigger the change you're trying to make though. If you're doing major adjustments or new functionality, you'll need to know the best practices for how to do things in that language, how the rest of the application is architected, etc. You may need to learn the languages standard library, if it has one, and if not, what are the best third-party libs for doing various specific things and how to bring them into the project. This could easily take weeks or months.
I suppose the ultimate level of contribution would be making significant changes to the language itself, its standard lib, or to any large, mainstream libraries used in that language. There, you also need to understand the overall purpose and mindset of the language and have a broad view of the ecosystem of how it's used and who is using it. That can take years, maybe decades.
I know a lot of languages and learning new ones gets easier as you learn more of them. I can read pretty much anything aside from some APL variants. It usually takes me 2-3 hours to get the ideas for most. I can usually get to writing reasonably good code over a weekend and that's usually enough to fix bugs or contribute code following someone else's design patterns but it's fairly slow going. From there things slow down a lot because you need to work your way through the ecosystem learning the common libraries and their interfaces so it's usually 2-3 weeks full time before I really feel fluent and 6-8 weeks full time before I'd be confident in adopting it professionally. I find that my coding style stabilizes (I look at code I wrote 6 months ago and would still write it that same way) in a language after about a year and a half.
This timing varies a lot depending on the language. Languages that are designed to be familiar to C#/Java/JS devs like Dart or Go and you fall in that camp, you can blast through the tutorial to get the syntax and be into learning idioms. If you're significantly shifting paradigms (e.g. picking up your first functional, logic, or concatenative language) then you can expect to spend a couple weeks being blocked in the ideas phase. Switching domains is similar so if Rust is your first systems level langauge, you're going to spend a LOT of time on OS and memory details that other languages handle for you.
So the answer to your question will probably hinge largely on the degree of similarity between your known languages and the one you wish to learn. To give a personal example: I currently know Java, Python, Common Lisp and R, in the sense that I have written non-trivial code in these. Last year, I tried to teach myself Haskell, and failed miserably. It was a very different syntax to everything else I knew and had several concepts that were quite alien to me. (It didn't help either that I didn't strictly need to learn it, and didn't have much spare time on my hands...) This year I am having to learn Julia for a project I joined, and I am finding it much easier. Although it isn't quite like any of the other languages I know, its syntax is close enough and I am already acquainted with its concepts. The result was that two weeks after my first exposure, I was ready to contribute code.
Depending on the language, I'd say a couple of weeks of full-time work. I tend to dabble with new languages, so the calendar time is on the order of months. That said, I've started a few jobs where I had to learn a new language trial-by-fire style, and I was productive and able to contribute to projects actively within days/weeks.
The thing is that _most_ programming is similar, regardless of language. You still have arrays and tries and dicts and functions. The patterns are largely the same. There are, of course, different families of languages where some patterns are more similar than in other languages, but for the most part, when I pick up a new language, I'm really learning more about syntax and structure than anything else.
For example, Go took me about 2 weeks to become really productive in it. Elixir, on the other hand, has taken me a lot longer (partially because I dislike Ruby -- especially Rails -- and therefore the syntax is fairly alien to me).
Hope that helped.
The thing I find challenging when learning while in a project, is that it's hard to separate then ecosystem, the framework and the language '.
The part that takes awhile is not the language it's the framework. I would say 6 months to a year.
To actually fully know any language and all its quirks is tough. Look at Ecmascript specification, it's quite long. And that doesn't cover all the undefined behaviors.
The problem is you're going to be slow until you get comfortable with the language, so it does take its toll on development speed. It's also harder to estimate and schedule since you have to take your own learning into account.
I find that it takes me a couple months to feel comfortable if I like the language (Golang) but with ones I don't (PHP) it always feels like a slog. To each their own here though.
* Dynamic-type languages usually only take 2-3 days to start contributing, sometimes I'll even have a new PR in on day 1.
* Static-type languages honestly take me awhile, usually around 1-2 weeks to start contributing.
* To feel actually competent, it usually takes a week in dynamic, closer to 2 months in static for me.
* Also, there's "weird" languages, like Erlang/Elixir/Rust/etc, which have their own learning curve. It just adjusts upward by different amounts.
If you do the former it’s very easy to learn something then forget it. Furthermore, echoing other comments, you would lack clear measures of success because it almost makes no sense to ask whether you truly “know” a language.
I know enough "software engineering" that I know pretty well what I want my code to do. So I just need to figure out how to express that in this new language.
Right now, I've been doing Python for 3-4 months and am starting to feel quite comfortable. Then again I'm far from an expert and would not do well at a Python centric interview.
It'll take ~3 months to hit my full stride and mostly understand the correct "way" to write that program (its common patterns, how best to use some of its features).
A deep ("expert") understanding of the language? Like 3 years, but varying wildly depending on the projects I use it for, the feedback I get from others, and the research and dedicated practice I put in.
On an extremely large Salesforce APEX project, it took me a few weeks to contribute and a couple of months to gain fluency. APEX is pretty much a subset of Java (with minor differences) so there was a lot less to learn there.
2 months sounds insane. I guess you did not click with Perl?
To achieve mastery in a language takes years of steady use, a constant attention to learning best practices, and good code reviewers.
Since mastering a language takes years, I use 20hrs rule. I spend 20hrs on reading, learning and practicing the language and environment itself and after that I dive directly into the project.
(I've been programming 9+ years.)
In general, though, the more languages you learn the more likely it is that the next one you try to pick up is easier.
It is pretty similar experience to learning a programming language. You can cram yourself to be productive on a new language in a week. But to master a language, you have to expose yourself into different situation when use the language. You can be good at using python to write some machine learning code, but how about a web application? How about writing qt? And also different size of a similar project need dramatically different architecture.
English is not my first language, so it is pretty similar situation. I can talk professionally as a software engineer. I can write a HN post that anyone can understand (or maybe not). I can read news, article about technology etc. But when I try to read literature such as novel, I found myself I don't have enough set of vocabulary in this setting to comfortably read without constantly checking dictionary. I cannot flirt a girl in English whose first language is English. So, obviously I don't claim myself mastering in English because I cannot use English effectively in all situation and social settings. But who does anyway if it is a second language? Similar to programming language, you just cannot master a language without knowing all or at least most aspect of different application and pitfall on implementation. Even the language inventor can't do that I believe.
So, the point taken is use a language to be productive enough on your setting is enough as a goal. You can aim to adopt more different situation if you want improvement. But perfect is the enemy of good.