Slashdot Mirror


Ask Slashdot: What Should Be the Attributes of an Ideal Programming Language If Computers Were Infinitely Fast?

An anonymous reader writes: Earlier today, Tim Sweeney, the founder of Epic Games, asked his Twitter followers an interesting question: "What are the attributes of an ideal programming language if computers were infinitely fast, and we designed for coding productivity only?" I could think of several things, the chief of which would be getting rid of the garbage collection. I was wondering what other things you folks would suggest?

42 of 326 comments (clear)

  1. I reject the question by SuperKendall · · Score: 4, Insightful

    This is stupid. Computer will never be "infinitely fast" or even close to it. There is always the possibility of ding computation in such a way as to drag down any system.

    There is always a compromise between programmer productivity, code maintainability, and system performance. It's not like you can realistically escape this triad so why pretend one leg does not exist? The computer programming industry has enough problems with magical thinking as it is.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:I reject the question by Topwiz · · Score: 5, Insightful

      Also stupid is getting rid of garbage collection. If it happens automatically at infinite speed, removing it would have no effect on your coding productivity.

    2. Re:I reject the question by drew_kime · · Score: 3, Insightful

      There is always a compromise between programmer productivity, code maintainability, and system performance.

      But if you didn't have to worry about the performance, what would boost the other two?

      This is how great advances are made. Design for the world you wish you had, then figure out how to make it real.

      --
      Nope, no sig
    3. Re:I reject the question by soft_guy · · Score: 4, Funny

      If the computer is infinitely fast, maybe it also has infinite memory so instead of garbage collection you could just leak everything.

      --
      Avoid Missing Ball for High Score
    4. Re:I reject the question by ShanghaiBill · · Score: 5, Funny

      Also stupid is getting rid of garbage collection.

      Even having a "programming language" would be stupid. An infinitely fast computer could just run a NN that was infinitely wide and infinitely deep and it would already know exactly what you want before you even ask for it.

    5. Re:I reject the question by DickBreath · · Score: 2

      Writing everything in BASIC does not achieve the desired outcome. The problem stated design for human productivity only (or coding productivity it said). While I was very fond of interpreted BASIC four decades ago (yes, I really was!), it is simply too low level a language. I would not try to use BASIC to write, say, a Sudoku solver. Or Rubik's Cube solver. Or a compiler. Or a modern large web application.

      I think the reason the problem stated infinite speed was so that everyone would focus on human productivity and not squibble about performance issues like static typing vs dynamic typing. Or compiled / interpreted. Etc.

      --

      I'll see your senator, and I'll raise you two judges.
    6. Re:I reject the question by DickBreath · · Score: 2

      The question is not stupid. It is to get one to think about what makes a human programmer more productive and not to focus on the computer execution speed. The way I read it is that even if a language was interpreted on a mechanical system powered by rodents running on spinning wheels; what attributes of a great programming language would make humans more productive at programming if execution speed were not a factor for consideration? If somehow your programming language would be fast and you didn't care how, then what would you want in a language to make your life more productive?

      --

      I'll see your senator, and I'll raise you two judges.
    7. Re:I reject the question by mikael · · Score: 2

      As programming languages become increasingly high level (assembler -> C -> C++ -> Java -> Python), the amount of generic boilerplate to handle module linking, object-orientated constructs also increases. At the far end, you have your SQL database and client which wrap an entire 4GL around a network protocol to implement and optimize complex search requests. Some programming languages can abstract away the need to understand advanced parallel processing techniques in order to take advantage of modern CPU designs.

      With assembler, you only deal with individual instructions and data structures that relate to the actual problem needing to be solved. C introduces a standard way of passing data in function calls and returning results using a stack. Some CPU's support instructions to save the entire register set onto a stack. Others support multiple banks of registers. There there is DLL or shared object loading which performs dynamic linking. C++ introduces class objects has a table of function pointers to support inheritance, pure virtual classes, derived classes, polymorphism and all other object-oriented programming theory. A complex multi-inheritance class object will be sliced up and recombined to generate a derived class from the base classes.

      All of this involves a substantial overhead, which for early low clock speed CPU's that weren't superscalar or support out-of-order code execution, made applications extremely sluggish. Now you have multi-core systems where a couple of CPU cores are used for OS background tasks, while one is used for the GUI and another for user application.

      --
      Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
    8. Re:I reject the question by ewibble · · Score: 2

      Dynamic typing vs static typing is a productivity thing for me, not speed thing, I prefer to catch my errors sooner rather than later.

      That being said if computers where infinitely fast I would have them run my program with all possible inputs and see if they crashed, got type errors. So I wouldn't mind type errors as much.

    9. Re:I reject the question by putaro · · Score: 2

      It only pauses because it takes CPU cycles to do the garbage collection - this machine is infinitely fast so GC would be instantaneous.

    10. Re:I reject the question by Place+a+name+here · · Score: 2

      If the computer was infinitely fast, there would be two programming languages.

      1. Nonlinear optimization.
      2. Teach-by-example, e.g. a neural net of maximum size for the RAM constraints, where all the weights are found by brute force.

      The former is for when you know exactly what you want, the latter is for when you don't and use supervised learning instead.
      For that matter, an infinitely fast computer is a hypercomputer, so 2. could easily be "the smallest Turing machine that produces the desired outputs given the inputs".

    11. Re:I reject the question by TheRaven64 · · Score: 2

      You seem to be conflating a stop-the-world tracing collector (a mechanism) with automatic garbage collection (a policy). Garbage collection is not non-deterministic because garbage collection specifies the objective (memory is automatically reclaimed), not the implementation. There are a number of GC designs that work on realtime systems, with guaranteed maximum pause times (look at some of David F. Bacon's work, for example). Garbage collection doesn't require mysterious pauses. There are a number of concurrent collector designs, which don't stop execution of the main program (Azul ships a very high-performance one for Java, for example).

      Any garbage collector implementation is in a tradeoff space between allocation throughput, tail latency, worst-case memory overhead, and overall CPU load. It's possible to heavily optimise for any of these, but not all of them at the same time. A lot of the problems people associate with garbage collection are due to picking an implementation that optimises for the ones that are not important for their workload.

      --
      I am TheRaven on Soylent News
    12. Re:I reject the question by Joce640k · · Score: 2

      +1

      GC creates more problems than it solves.

      The knowledge/discipline needed to use GC properly isn't less than learning to use reference counting.

      Worse: In a GC language you'll be retyping the exact same boiler plate code over and over gain to workaround the problem. This leads to copy/paste errors, code verbosity that hides other bugs, forgetting to do it, etc.

      --
      No sig today...
  2. Presumably... by sycodon · · Score: 4, Funny

    ...and infinitely fast computer would be self aware and wouldn't need instructions.

    --
    When Fascism comes to America, it will call itself Anti-Fascism, and tell you to give up your guns.
    1. Re:Presumably... by OzPeter · · Score: 2

      ...and infinitely fast computer would be self aware and wouldn't need instructions.

      Yeah but you have to watch out for the pain in all the diodes down its left side

      --
      I am Slashdot. Are you Slashdot as well?
  3. Line numbers by aicrules · · Score: 3, Funny

    And GOTO, no GOSUB though, that's dumb

  4. So painfully obvious by American+AC+in+Paris · · Score: 4, Funny

    The language for an infinitely fast computer is called DUH.

    There are no keywords, operators, or logic structures; the entirety of the language is you typing "DUH" into the command line, then hitting ENTER.

    Upon pressing ENTER, you are presented with every possible program that could ever exist. All you need to do is select the one you want.

    --

    Obliteracy: Words with explosions

  5. That makes no sense... by famebait · · Score: 4, Insightful

    Getting rid of garbage collection? The feature whose whole point is boosting productivity at the cost of performance? In a setting where performance is explicitly not and productivity explicitly is? Can you spell "hangup"?

     

    --
    sudo ergo sum
    1. Re:That makes no sense... by beelsebob · · Score: 3, Insightful

      Yeh, I was thinking exactly this. The valid reasons for getting rid of garbage collection are along the lines of "it causes the application to end up using a shit ton of memory if you want it to be any way performant", and "you can't get sensible real time guarantees when your whole program might pause to execute GC".

      GC is exactly what you would want if you can guarantee that it executes in 0ms.

  6. CLP by sourcerror · · Score: 2

    It should be a highly parallel language, where you can program with constraints.

    1. Re:CLP by _merlin · · Score: 2

      If the computer is infinitely fast, you can avoid the complication that parallelism brings with it. No need to spread out over multiple execution units if one is infinitely fast anyway.

  7. garbage collector? by Frederic54 · · Score: 2

    There is no garbage collector in C, so it must be the ideal programming language ;-)

    Special mention for assembly too.

    --
    "Science will win because it works." - Stephen Hawking
  8. Monkey's Paw by thedarb · · Score: 2

    It should be capable of understanding normal language, any known language, and execute the idea of what you asked for... But do so with disastrous unconsidered consequences. Man should not toy with technology!

    --
    This sig intentionally left blank.
  9. Re:Stupid thought experiment is stupid. by Anonymous Coward · · Score: 2, Insightful

    You still have to write the correct logic. So the question is essentially, "what features of a programming language lead to least logical errors?"

  10. code would look like shit by netsavior · · Score: 5, Funny

    I just imagine a world of cross-joins, extremely complicated in-string, lazy iteration and the like.

    If there were no penalty for pivoting data or iterating though sets, we would all gravitate toward the shittiest constructs imaginable...

    I mean hell, browsers are basically expected to be limitless now... HTML hello world used to look like "Hello World" Now it looks like
    "Hey javascript framework, load 500 modules, then ask the server what "Hello" is, then ask the server what "world" is, then style it all in whatever your 13 generated CSS files say it should be styled as, and tell google analytics that someone looked at my hello world page."

    1. Re:code would look like shit by sinij · · Score: 2

      I propose netsavior lema: Infinitely fast computers would result in infinitely shitty code run on it all the time.

  11. Whole New Vistas for Zeno's Paradoxes by American+AC+in+Paris · · Score: 2

    Wouldn't an infinitely fast computer be completely useless in that doing anything with it would result in a race condition?

    --

    Obliteracy: Words with explosions

  12. Re:Garbage collection by beelsebob · · Score: 2

    The amount of memory GC uses isn't a problem if you have infinite performance.

    GC uses more memory than manual memory management exactly because you can't run it all the time - you have to let the heap grow, and then do a collection when you stand a chance of actually freeing a bunch of memory.

    With infinite performance, you can run it after every single line of code that might possible have changed which bits of the heap are referenced still, that means you actually get *improved* memory usage over manual memory management (since no one gets that perfect, in general).

  13. syntax by Mysund · · Score: 2

    It should be able to understand and do whatever comes after "I want you to..." both as a vocal or written statement.

  14. Wirth's Law by rikkitikki · · Score: 2

    I guess he never heard of Wirth's Law. Compared to 20 years ago, our computers are operating at and infinite speed with ridiculous amounts of RAM. Yet the desktop, IDEs, and applications seem slower than they were 20 years ago, require Gigabytes(!!!) of RAM, and do not seem to do anything more than they did before. Go figure.

  15. Ask this question another way... by yodleboy · · Score: 4, Insightful

    What a pedantic bunch. Mental race conditions because of the word 'infinitely'. Anyway, let's ask this question a different way. "If modern hardware had been available at the time, how would you have designed languages like C, C++ and JAVA? What compromises were made that continue to impact those languages?"

  16. Re:Garbage collection by DickBreath · · Score: 2

    One of the goals of the problem statement was to improve human productivity. Therefore GC would be a requirement. Not having to manually manage memory removes a large burden from programmers.

    GC has an often overlooked, but fairly silent other advantage. It greases the compatibility of libraries written by many different authors. All of the libraries are guaranteed to have the same memory management discipline. Just to pick on C / C++ for example, multiple libraries might have different memory management disciplines. It is necessary to understand whether the API has special functions to deallocate some structure, and who is responsible for such deallocation. With GC all of that disappears. If an API call hands me back a datastructure, I just let go of it when I'm done with it. No concern about who deallocates it. The GC is what deallocates it when there is no longer a reference to it.

    Another important attribute would be toolability. Java, for example, is very toolable. IDEs for Java are able to statically deduce a great deal and then offer intelligent suggestions to auto complete things as you type. There is doubt about what type of parameter some function has -- because it's statically typed. There is no doubt about what local and global variables you have available, of that type, which could be passed as the actual value for that parameter.

    Basically the Editor knows about your source code as well as the compiler does. If you click on some function name, or variable name, or class name, it is unambiguous where it is declared.

    Modern Java IDEs also can intelligently rename things. If you rename some identifier, the IDE knows precisely what other parts of your entire source code base need to have this same rename done. If I change function 'abc" to "def", not only is the declaration changed, but every reference to that function throughout the program. But if there were another local function somewhere else with the name "abc", it would not be changed, nor would references to that. The compiler knows exactly, unambiguously what references what.

    There are many other powerful refactoring tools as well. People who say they will use a simple text editor because they don't like the bells and whistles of a modern IDE is like someone saying that they would rather dig a huge ditch with a shovel because they don't like the noise of a backhoe.

    Static typing would be a must for large programs. Modern languages with type inference allow you to avoid typing in much of the type information, yet still have static typing.

    Static typing is not primarily about performance (although it is about that). (And the problem definition said performance is infinite.) Static typing is also about correctness of code and compile time checking, and the toolability and refactoring I mentioned.

    --

    I'll see your senator, and I'll raise you two judges.
  17. Infinity/Infinity by pellik · · Score: 2

    So if I screw up and create an infinite loop this computer would complete the loop anyway in only one unit of time?

  18. Re:If computers were infinitely fast ... by skids · · Score: 2

    1) The language would be graphical

    No, physical. It would have one analogue keyword consisting of how hard you are hitting the robot with the stick, and/or how loud you are yelling "no, you stupid git!"

  19. Re:Stupid thought experiment is stupid. by Zeroko · · Score: 2

    There very much would be a reason to change programming languages. With infinite speed, you could do an exhaustive search for proofs of correctness, so you could write the requirements for the program & have the language formally verify it without any extra effort (provided a proof of correctness exists at all).

    For that matter, why not just write test cases & constraints & have it find the simplest program that passes all of them? At some point, you would either have enough constraints that the simplest program is correct, or you would realize you did not actually know what you wanted.

  20. Re:Bad idea by ranton · · Score: 3, Informative

    Which is why the question is stupid. This is not how advancements are made, this is how people are lead down false paths with a dead end. Advancements are made by considering the impact of all important factors...

    This line of thinking is foolish. Advancements are made from all kids of approaches. If you want to think innovatively, you should probably be following paths you assume will lead to a dead end. If are aren't failing most of the time, you aren't thinking very innovatively.

    --
    -- All that is necessary for the triumph of evil is that good men do nothing. -- Edmund Burke
  21. Re:Naming, copyright, and caps by tlhIngan · · Score: 2

    I can think of reasons.

    The first is namespacing. A program needs to identify that it wants to use a particular library or security updates thereto, as opposed to a similarly named library without the needed functionality.

    The second is copyright. A computer program is thought to be a derivative work of the libraries that it is explicitly designed to load.

    The third is bandwidth. Even if computers are infinitely fast, radio frequency bandwidth isn't. It costs money to launch a satellite or build a tower, money that must be recouped from subscribers who may not be willing to pay for a large enough monthly data transfer quota to allow continuous retrieval of every library under the sun.

    And I'd design the language so you don't worry about that. If you don't use a library, it will automatically be removed.

    Hell, I don't think I would even bother with such low level trivialities.

    Star Trek is the better example. They ask the computer what they want done, the computer figures it out and presents them the output. They're programming, but not. Or how they program the holodeck - they ask the computer to generate a character on the holodeck, then load up various behaviours using commands. They can even program simulations of characters.

    Or how they reprogram the Universal Translator with a few parmeter changes and get it working again, or adjust the phasers to transmit in some way You think it up and with a few keystrokes, everything is reconfigured.

  22. Re:Garbage collection by tepples · · Score: 2

    How does a garbage collector that handles circular references determine which objects to finalize first?

  23. How do you make it easier and idiot-proof? by Beeftopia · · Score: 2

    The real question being asked here is, "How do you make a programming language easier and more idiot-proof?" Right off the bat, there is just no substitute for ability + experience. You need both (or if not experience, a whole lot of ability).

    Remember, the thing a programming language does is translate human-readable text into processor instructions - one's and zeros.

    How to do that more easily and have the program robustly do exactly what you want? Object oriented is brilliant IMO, for example. Forcing you to make classes (a way to group code), and create complex methods (functions), and just instantiate the object (the mere act of doing so running multiple functions, and being able to call with one line a function that does a whole bunch of stuff.

    First there was assembly, line by line interaction with the processor. Then Basic, then function-oriented programs which groups functionality into functions, then object-oriented programming (grouping functionality into classes and their methods), and object-based programming (e.g. JavaScript - everything is an object, except primitives).

    What is all this leading to? Trying to take the average human's mental concepts and turn them into machine code in an easier and more error-proof fashion.

    Deep stuff for a Slashdot thread. We'd need the likes of Claude Shannon and Bjarne Stroustrup to really bite into this.

    People are still going to need to learn the language of the computer, even if/when it could understand natural language ("I wanna add this list of numbers together, divide it by the number of numbers" versus "I want the average of this list of numbers". "And then I want to display it in a flashing red box.").

    Christ, what a maintenance nightmare. Ease of generation of machine code versus maintainability? "Why was this asshole doing all this bit shifting in this function?"

    Well, hopefully I framed the real question a bit better, got no idea of what the next evolutionary step would be.

  24. If such existed. by jcochran · · Score: 3, Interesting

    I'd replace a programming language with more of an interview system.

    Basically, you'd tell the computer what problem or task you wish it to do. If it knew how to perform the task, then your job is complete. If it doesn't know, it would ask you to break the problem down into smaller sub tasks. You do so and for each sub task that the computer knows how to solve, it would do so. And for each sub task that it didn't know, it would recursively ask how to solve those sub tasks. As for a library, the computer would remember every task that it had been taught previously.

    There would still be programmers, but their job wouldn't be using any specific language, but instead describing how to solve problems or perform tasks.

  25. Re:Logically Inconsistent by La+Gris · · Score: 2

    WIth an infinitely fast computer you don't program steps or equations rules to compute the result. Instead, you infinitely fast generate random result sets and program simple broad rules for what is an acceptable result match. Your CPU has infinite branch prediction, so it explores all paths instantly. I really think the poster meant quantum computer programming language. Because Quantum computers are somehow infinitely fast because they can explore all results simultaneously.

    --
    Léa Gris
  26. Re:Naming, copyright, and caps by PingPongBoy · · Score: 2

    Star Trek is the better example. They ask the computer what they want done, the computer figures it out and presents them the output. They're programming, but not. Or how they program the holodeck - they ask the computer to generate a character on the holodeck, then load up various behaviours using commands. They can even program simulations of characters.

    Or how they reprogram the Universal Translator with a few parmeter changes and get it working again, or adjust the phasers to transmit in some way You think it up and with a few keystrokes, everything is reconfigured.

    The question was about an infinitely fast computer. Star Trek is a few steps beyond current computer speeds but still not infinite. Still, thinking Star Trek is better than what some others are thinking so far.

    When you go into a physical library, you see knowledge and other works somehow compiled, for all you know over an infinite past amount of work. You wouldn't dream of spewing such an output within your own predicted lifetime. Then being a slashdotter, you ask yourself, what is the ultimate state of the Library of Congress if it simply progresses linearly yet to perpetuity? It will be nothing less than boggling.

    So perhaps there is a command in the idealized programming language that looks like this: querylibraryofcongress, or perhaps: askjeeves. Even such commands underestimate the power of infinity. When considering an infinite computer, it's time to reverse engineer. You ask yourself, how would I make a light saber?, not ever living in a world where one exists - that's the kind of reverse engineering going on here. Now, reverse engineer the infinite computer ...

    Here's another command: costzero. I.e., run without costing anything! Somehow it will figure out how to do so. Naturally, a computer of infinite speed would be ensured to be connected sufficiently to the universe in order to obey.

    Here's another command: goaheadmakemyday. The output will make you happier than whatever you can imagine you want.

    --
    Know your pads. One time pad: good for cryptography. Two timing pad: where to take your mistress.