8 ms·
Ask HN: If you could only code with one language which would it be?
My friends and I are discussing which language we would choose if we only could code in one language for the rest of our lives. Some arguments have been made for c++, SQL, Java, python and JS
- bllguo 9y agoSQL?? What is the argument for that?
- Grazester 9y agoC# I was a noobie programmer at the time and only programmed in C++ and php. I then experienced what it was like to truly love a programming language after I was employed to do a tiny project in C#
- jedisct1 9y agoRuby. By far the language I'm the most productive with.
- hackme1234 9y agoPython. Its simplicity is unparalleled.
- romanovcode 9y agoC# It has all you mentioned: - C++ (Strong OOP + Static typing) - SQL (LINQ) - Java (Well, no comment here) - JS (dynamic, async/await)
- dlahoda 9y ago- C (native pointers, ref parameters and returns, structs)
- romanovcode 9y agoYeah, forgot about that. It's a new feature of 7.2 AFAIK.
- brettkromkamp 9y agoClojure. Almost infinitely extensible.
- dagw 9y agoRealistically, Python. Not because it's the best, but because it's the only language that I feel confident will have libraries/bindings for everything I need. Or as I've heard someone else put it, python is the second best choice in any situation.
- j-pb 9y agoIsn't the java ecosystem more vast though? I found that even though python has a ton of libs for everything most of them are unmaintained. And I'd rather not write lots of C bindings myself :/
- dagw 9y agoJava is at least a close second. Very generally speaking, I've found that Java has a slightly better ecosystem when it comes to more 'enterprise' solution, while python is slightly better on the science and engineering front. Also, python is the standard scripting language in just about every application I run into so, if for no other reason, I wouldn't want to give on a python just because of that.
- naikke 9y agoRuby
- bionsystems 9y agoC so I can work on most of the stack (and why not write my own languages if needed).
- fractalwrench 9y agoKotlin. It has has great tooling with IntelliJ, loads of libraries in the JVM ecosystem, and Native/JS build targets are in the works. It's also far less verbose than Java.
- sghiassy 9y agoJavaScript - Because it’s on the Web, Phones, Server, Embedded Decices, etc etc. By having the widest array of hardware devices to build on, I’d have the opportunity to solve the widest scope of problems.
- shakna 9y agoC, because I care about speed, program size, and multiple CPU architectures. Or Stackly, a language I've been writing for nearly two years now. Like C, it's performant, compiles to tiny binaries (it maps fairly close to assembly under the hood), but unlike C it has a ref-counting GC, compile-time and runtime type safety. set [hello] fn 'displayln [Hello, World!] hello I did used to care a lot more about community adoption or libraries, but less so today. If you're not dealing with protocols or encryption, and there is no library, and you can spare a month or two, then writing the library isn't a hard task. First fortnight to implement, six weeks to fuzz n fix. But then, I've been forced to work with all sorts of estoric languages in my work, from PL1 to FORTH to Brainfuck, so my experience is unlikely to be the norm.
- johnny_1010 9y agohttps://github.com/shakna-israel/stacky https://github.com/shakna-israel/stacky
- shakna 9y ago'fraid that's something else entirely. That was part of a uni assignment. Stackly isn't public yet, and probably won't be until I finish the type-checkers.
- alt3red 9y agoPython, because it's what I know best and what makes sense to me.
- vectorEQ 9y agomachine code. because you couldn't extend any higher level language if it needed it, since you wouldn't be able to write assembly >.>. you'd be stuck with 1 system forever, not being able to make use of any new cpu or hardware features etc.
- deepaksurti 9y agoCommon Lisp. Why? [0] [0]: http://p-cos.blogspot.in/2014/09/why-i-like-common-lisp.html http://p-cos.blogspot.in/2014/09/why-i-like-common-lisp.html Common Lisp / Scheme are great to learn about programming languages themselves. think learning about closures in CL vs in ObjC and you will realize how simple concepts become awkward and secondarily builds your taste so you know engineer who prides in knowing C++ complexity is a fucking idiot. Personally, CL has helped me quickly learn hard subjects (3D graphics), prototype software for open ended problems, etc etc. And any given day, give me a language with live editing and updates, I hate the edit/compile/test cycle.
- bjoli 9y agoScheme is what I use when I want coding to be fun (with guile being my implementation of choice). Other languages have gotten nice repl environments in the last year, but the integration with the language is never as good as lisp repls.
- xelxebar 9y agoLearning a lisp is on my to-do list and I've narrowed it down to guile or sbcl. I'm curious what kinds of projects would cause you to reach for common lisp over scheme and vice versa. Also would be interested in any other thoughts comparing the two.
- Jtsummers 9y agoEither Common Lisp or Scheme are effective introductions to lisp. Both languages are standardized. But Common Lisp has a large standard library (pros and cons depending on your tastes and interest in the language). Scheme has the benefit of some particularly excellent introductory texts (Little Schemer, Seasoned Schemer, Structure and Interpretation of Computer Programs, How to Design Programs). The first two are not free, but are great introductory texts (and can be used with Common Lisp with some adaptation, same with the other two), the second two are freely available online. Scheme is also a conceptually "purer" functional language than Common Lisp. Depending on your background and feelings towards other functional programming languages that may have some appeal to you. Common Lisp has a comprehensive standard library via the components described in The Common Lisp HyperSpec. With Quicklisp and other things you can easily add packages to your projects extending your environment to provide support for nearly anything anyone has ever written a CL library for. From a technical perspective, Common Lisp can be a more pragmatic language in many ways. It allows you to drop into base procedural code, or write functional code. It has a built-in object oriented system (CLOS) that has a lot of fantastic features. Much of this can be added to Scheme, and may be available through an SRFI, but is not baked-in. If you're interested in implementing object systems, Scheme can be a fun language to use for that purpose. Setting aside those, another big difference is one that sometimes causes heated debate, but for me is just a thing to keep in mind. Scheme is a lisp-1, Common Lisp is a lisp-2 (really a lisp-n). Scheme has one namespace that everything uses (though you can encapsulate things inside of closures and such). What this means is that at the top level your functions and variables share a namespace. If you make a function f and a variable f only one of them exists. This leads to some cleaner expressions when using a functional style as you can just use the variable name in the function position. In Common Lisp you may have to use something like (apply #'f some-param) when f is a variable holding a function reference. This is a minor thing, in my view, but if your intent is to explore the functional side of lisps it can be nicer to use Scheme. Common Lisp has separate namespaces for functions, variables, macros, and other entities (I'd say objects but I want to avoid confusion with the sense of object-oriented programming objects). Both have module or package systems for organizing projects. Both have good testing capabilities baked in or that are easy to add on. Both have active communities (with a decent amount of overlap between them).
- pmiri 9y agoIf this is a desert island-type scenario, haskell. If I had actual time limits, python.
- mobilefriendly 9y agoPHP, because it is simple, powerful, has bindings for everything, and the largest community with huge projects like Wordpress and Drupal. I know it isn't as trendy as python but all of the arguments made so far for python apply to php as well, and php is older and more widespread.
- KingMob 9y agoPython is actually 4 years older than PHP.
- pythonaut_16 9y agoPython actually predates PHP by quite a bit. A (non-scientific) look at Wikipedia puts Python's first public release in 1991, and PHP in 1995. But Python's roots actually go back to the late 80s, while PHP was started and released in 1995. PHP was really originally created as a collection of helper functions, not a full programming language.
- thomascgalvin 9y agoI'm a recent convert to the Church of Kotlin. If you know Java, it takes a week or so before you're comfortable, and after that it's magical. All of the boilerplate, all of the tiny little frustrations and bad ergonomics, are just gone. IntelliJ is a fantastic IDE, too, and I didn't bother picking it up until I started playing with Kotlin. Kotlin compiles to JVM bytecode, and it runs everywhere I'm currently deploying applications. It can be mixed in with existing Java baselines, and interoperability is almost perfect. Kotlin also cross-compiles to Javascript, and there's a new Native target, which I haven't played around with yet, but seems like a decent answer to Go's statically compiled, platform native, single binary output. Lastly, there's an experimental feature that allows you to write one source base and target native, the JVM, and browsers. That finally gives me a single language that I can run anywhere that isn't Javascript.
- vram22 9y agoIs the Native target stable, or experimental as of now?
- juliangoldsmith 9y agoPersonally, I'd go for Rust. It can do (most) everything that C can, but is (usually) a lot easier to work with.
- avmich 9y agoI've thought about that for some time until it started to feel like a wrong question. I usually wanted to code in one language to save learning many languages to an expert level. Also it felt good to have a uniform code on various levels of the system - something which today in JavaScript world is called "isomorphism". Then I realized I'm really doing different things in different layers, and in a big language I'll perhaps use different parts of the language - effectively several languages. For a small language I'll probably be creating necessary constructs first - again, different for needs of different layers - and then would use those. Now I think it's better to have the ability to adjust language after the task, and here Lisps look rather good. Even more, with security in mind I want to use not only "language suited for the task", but "language minimally suited for the task", so it's hard to use it incorrectly and easy to reason about abilities of the particular software layer. Here, again, Lisp-like languages are a good platform. Some others languages suitable for DSL creation (Haskell? Tcl?) can also be good.
- xstartup 9y agoI've most extensive experience in Python but I choose Ruby. Then Rust, finally Go.
- codegladiator 9y agogolang
- dasmoth 9y agoIf it absolutely had to be one thing for everything (including projects where I have to work closely with others), JavaScript. For solo stuff Clojure/script. But please don’t let it come to this. I’m happiest as a polyglot.
- quotemstr 9y agoWhat does this question even mean? Give me one language and I'll implement others as needed. Where do you draw the line between data format, template system, and "language"?
- dTal 9y agoFrom this perspective, the correct answer is "assembler". Everything else is just fancy tools to generate that, right?
- xelxebar 9y agoWhich flavor? GAS, NASM, MASM? Should we go with straight opcodes? And if we're talking it this far, what CPU architecture? Etc ad infinitum...
- miloelias 9y agoYou're right the question isn't entirely complete. It was more of a fun discussion type of question in my opinion.
- vorg 9y agoWhich language would I choose if I could only code in one language for the rest of my life? English, of course. I can encode more meaning in English than those examples you gave, and that's my criteria. But I wouldn't blame someone else for choosing C if their criteria was how fast code written in that language could run on a PC, or Lisp if their criteria was building DSL's quickly, or Russian if their criteria was communicating with people living in Novosibirsk.
- amerkhalid 9y agoI am learning Swift this year. Surprised it hasn't been mentioned yet. I am hoping to make it is my main language, I doubt if you can live with only one language forever though. My reasoning is that this is one language that you can use to write apps for MacOS and iOS possibly sharing some codebase. It doesn't run on VM, so should be faster. Swift Playgrounds got me interested in this especially the fact that it seems to work with a lot of toys like Mindstorms. It might even evolve to support server side dev. So I see it as decent investment. Also people in Apple's ecosystem seems to spend more money on apps even with smaller market share of Apple. And really want to write apps that do something interesting as I am really bored with another CRUD webapp with pretty UI.
- mankash666 9y agoC
- deadmetheny 9y agoPerl.
- earenndil 9y agoLisp, not necessarily because it's good, but because it's easier with reader macros to transform another language into it as needed.
- k120 9y agoLisp. With metaprogramming technique I can add any modern paradigm and language features.
- xelxebar 9y agoSorta hijacking the question here, but I'm curious if anyone here prefers using some concatenative language. If so, what language (s) and why? I recently stumbled across http://concatenative.org http://concatenative.org and my curiosity is thoroughly piqued.
- j-pb 9y agoClojure. Give me immutability or give me death :D
- akmittal 9y agoDefinitely JavaScript. It is almost everywhere Frontend, Web back-end, IoT, machine learning. It may not have good reputation for its past but new JavaScript is quite enjoyable. Being a dynamic language how fast JavaScript has become always surprises me.
- malyk 9y agoRuby