Ask Slashdot: What Should Be the Attributes of an Ideal Programming Language If Computers Were Infinitely Fast? 326
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?
I reject the question (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.
Re:I reject the question (Score:5, Insightful)
Re:I reject the question (Score:5, Funny)
Re: (Score:2)
The point is, that wasn't specified, but infinite speed was. So sacrificing memory to gain speed makes no sense.
Re: (Score:3)
+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.
Re:I reject the question (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.
Re: (Score:2)
Having GC improves productivity. You no longer need to free anything you allocate. It does not mean you have infinite memory. Just that the system will deallocate things for you.
Improving productivity was one of the requirements of the problem statement.
Re: (Score:3)
It only pauses because it takes CPU cycles to do the garbage collection - this machine is infinitely fast so GC would be instantaneous.
Re: (Score:3)
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 c
Re: (Score:2)
Re: (Score:2)
Here's an example then. If speed wasn't an issue, every data structure could be a database.
Re: (Score:2)
Re: (Score:3)
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 mo
Re:I reject the question (Score:4, 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.
Bad idea (Score:2)
But if you didn't have to worry about the performance, what would boost the other two?
From experience, things that would badly impact actual performance on a computer that is not infinitely fast...
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...
Re:Bad idea (Score:4, 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.
Re: (Score:2)
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.
Actually it's more like create a magic fantasy land and create solutions that don't work anywhere else. Or how space ships would look like if we had warp cores, if you prefer the sci-fi version. The first thing I'd get rid of is threads, who needs it if you have infinite single thread performance? Shaders? Dedicated hardware? You'd make games without all the tricks just ray trace everything. Databases with zero indexing and roll-ups, because you can do an infinite number of table scans and aggregations inst
Re: (Score:3)
Re: (Score:3)
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 [wikipedia.org], so 2. could easily be "the smallest Turing machine that produces the desired outputs
Re: (Score:2)
What's funny is that you provided a meaningful answer to a question that you had already identified as stupid.
To actually answer the question, a language like COBOL that uses pseudo-natural-language would probably be king, as it would be the least like programming, and also assuming an infinitely fast computer, it would be capable of handling proper voice recognition. Interfacing with the computer and programming it would be more like the fictional LCARS on Star Trek: The Next Generation, where one simply
Naming, copyright, and caps (Score:2)
library includes (why load separate libraries when the system is able to have all of them available?)
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
Re: (Score:3)
Re: (Score:2)
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.
Under such a design, how would a library be retrieved for the first time without requiring payment to the ISP to increase the user's monthly Internet data transfer quota?
Hell, I don't think I would even bother with such low level trivialities.
The lawyers would. In the Napster, Aimster, and Grokster cases, a company was held responsible for its users' copyright infringement. If the execution environment that your company publishes treats copyright as "low level trivialities", how long do you expect your company to continue to exist?
Re: (Score:3)
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
Re: (Score:2)
What's funny is that you provided a meaningful answer to a question that you had already identified as stupid.
Gee, I guess I should have used the </sarcasm> tag on it so people with no sense of humor would know I was kidding.
Logically Inconsistent (Score:2)
If they were 'infinitely fast' it wouldn't matter; you could write everything in interpreted BASIC and it wouldn't matter.
Oh it's even worse than that. If you have an infinitely fast computer you never need to program it because a simple random number generator can immediately simulate the effect of an infinitely number of monkeys typing on an infinite number of keyboards in no time at all. Not only will this give you every possible program in every possible language in no time but searching for the right one will be easy too - infinite speed is really useful....and as a side effect you will also produce the works of Shakespe
Re: (Score:3)
Re: (Score:3)
I think the reason the problem stated infinite speed was so that everyone would focus on human
Re: (Score:3)
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.
Re: (Score:2)
Re: (Score:2)
Computers are infinitely fast and coding productivity is the only problem left
Tell that to people coding for a few billion mobile devices...
Presumably... (Score:5, Funny)
...and infinitely fast computer would be self aware and wouldn't need instructions.
Re: (Score:3)
...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
Re: (Score:2)
"Infinitely fast" could run brute force solution space searches on anything... no need for genetic algorithms, neural nets, or contortions to fit quantum models. That would make AI pretty easy to develop by comparison to what we have now.
Of course it might be hard to teach such a platform the concept of time, but as Thunderclese said: Time is an abstract concept invented by carbon based life forms to monitor their ongoing decay.
Line numbers (Score:4, Funny)
So painfully obvious (Score:5, 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.
That makes no sense... (Score:5, 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"?
Re:That makes no sense... (Score:4, 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.
Garbage collection (Score:2)
getting rid of the garbage collection
Why would that be the chief thing to drop if you had infinite performance? The only big problem with garbage collection IS performance.
Re: (Score:3)
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 manage
Re: (Score:2)
Actually if you can have several times the memory than your program actually needs, then performance is no longer an issue with any modern concurrent GC.
I'm serious.
Programmer time is expensive. Hardware is cheap. Memory is cheap. Would you rather get your code to market sooner because you can use a higher level language without memory management in exchange for adding an extra 32 or 64 GB of memory? Getting to market sooner may
Re: (Score:3)
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 me
Re: (Score:2)
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
Which makes it more or less equivalent to reference counting.
Re: (Score:2)
No - it's still more correct than reference counting in that it manages to resolve reference cycles correctly.
It just also requires a massive scan of the heap rather than just a simple decrement of an integer though.
Re: (Score:3)
How does a garbage collector that handles circular references determine which objects to finalize first?
CLP (Score:3)
It should be a highly parallel language, where you can program with constraints.
Re: (Score:2)
What? Fuck no!
Look, parallelization solves a lot of problems on current, non-infinite programs. However, it also introduces complexity. If speed were not an issue, and you just wanted to optimize in terms of programmer time, you would not allow multiple threads. It would be literally: LoadResource(); SolveTravelingSalesmanProblem(); Something(); in order instead of setting up callbacks so that the person could keep using the computer and queueing other things up while that was happening. Far easier to
Re: (Score:3)
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.
garbage collector? (Score:3)
There is no garbage collector in C, so it must be the ideal programming language ;-)
Special mention for assembly too.
Monkey's Paw (Score:3)
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!
be able to type.. (Score:2)
High level features (Score:2)
An ideal programming language would support powerful features like the following statement:
print("Does P == NP?", P == NP ? "Yes." : "No.")
code would look like shit (Score:5, Funny)
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."
Re: (Score:3)
Whole New Vistas for Zeno's Paradoxes (Score:3)
Re: (Score:2)
No, you'd just use locks everywhere. With infinite speed, the overhead caused by locking before every action wouldn't matter.
Yes, but if speed is infinite, then results are produced instantaneously, regardless of their complexity; the computer performs any given task in zero time. If the computer exists as a physical entity that performs some kind of action to achieve its result (e.g. shunting electrons down pathways etched in silicon, actuating relays, modulating-the-shield-harmonics-spooky-motion etc,) then in order for it to work, that action needs to happen in zero time, as well. The concept of sequential physical actions in
Determinism (Score:2)
They don't have to be infinitely fast. They need to be infinitely deterministic. Ie. a measurement or an interrupt must arrive in time, with in-time defined by the maximum timing boundaries of the experiment being executed.
If that happens with a garbage-collector (which is now infinitely fast), then we could perhaps use higher languages for real time.
Obviously if performance no longer matters at all, all function parameters, both in and out, could be checked. Sure why not, then.
And how about having infinite
Re: (Score:2)
You can already use GC languages for soft real time. Like a game. Or signal processing. Simply DO NOT allocate any data structures during the soft real time loop. Set up everything. Allocate all data structures in advance. Then enter your soft real time loop, do your signal processing, high frequency trading, game loop, etc.
I would point out that big banks and enterprise applications use Java. Java is used in high frequency trading.
Re: (Score:2)
Hey! It's not our fault that your employer makes shitty technology decisions. No need to make us worry about it.
Silly money people.
Minimizing lines of code to zero (Score:2)
Make sure it implements ... (Score:2)
Thought experiments... (Score:2)
Need to be built as carefully as real experiments. This isn't one. If the computer is infinitely fast then the computer language can be structured to process non ambiguous natural language, we don't need computer languages, just people trained to be unambiguous.
That is totally ignoring the fact that our society runs on the premise that computation is expensive, and an infinitely fast computer would destroy all concepts of security based on expensive computation, and society would collapse and there would
syntax (Score:2)
It should be able to understand and do whatever comes after "I want you to..." both as a vocal or written statement.
Very simple (Score:2)
I would create a counter to count from 0 to infinity, and point the CPU IP do the address of that big integer. The program I want will be generated somewhere along the way. The trick is to filter out the ones you don't want.
Re: (Score:2)
You just created the first need for symmetric multiprocessing right there: as your first computer's results must be filtered by a second infinitely fast computer.
Assembly language would make it infinitely faster. (Score:2)
Your program would therefore be done before you'd written it. You can then say, "what a dumb-ass I will have had been." I'll just rewrite it. Oh, I will have did? That's looking pretty good. Let's just...
Wirth's Law (Score:2)
I guess he never heard of Wirth's Law [wikipedia.org]. 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.
Ask this question another way... (Score:5, Insightful)
Re: (Score:2)
What a pedantic bunch.
I mean, YES, and also, it turns out that the pedantic approach to this question is very very fun. :D
Hard coded gosubs (Score:2)
If it's infinitely fast, and I don't have to maintain the code, why not?
Good News/Bad News (Score:2)
Infinity/Infinity (Score:3)
Get rid of deadlocks (Score:2)
everything is dynamic (Score:2)
All relationships (e.g. inheritance, type) would automatically be dynamic. A framework for doing static typing and inheritance would be provided as part of the runtime.
Similarly, all components could be naturally and transparently distributed with little or no additional code complexity. That infinite speed could be kept busy making sure there are no race conditions.
Finally, no control structures in the language itself -- all control structures would be part of the runtime and it should be straightforward
oh yeah (Score:2)
The language should allow full introspection and reflection as well.
the question is almost self-defeating (Score:2)
if computers were literally infinitely fast, you could pretty easily replace most of "coding" with brute-force graph search of the program space. the profession of programming as we know it would be obsolete within a few years; it would remain as a quaint curiosity practiced by philosophical lisp-weenies and hardcore enthusiasts. maybe there would be a niche market for "artisanal programs" or something.
Re: (Score:2)
It would not support ... (Score:2)
... bubble sort.
Get rid of the math. (Score:2)
10 Program killer app
20 Make lots of money for me with minimal effort.
30 goto 10
Because math is hard.... and paying for education and experience is not good for corporate bottom lines.
Write a programming language that Middle Managers can use to design our products.
We already know the answer: It's called DMI/DME. (Score:2)
If computers would be infinitely fast and thus also have nigh infinite memory and storage (because fractal compression at zero cost - duh) we'd all inmediately be using what is called a Direct Manipulation Interface (DMI) or Direct Manipulation Environment. Squeak [squeak.org] comes close to that, but a good DMI would be something like Flash combined with RunRev using Python or something as a PL, including a touchscreen object modeller for contemporary tablets and some other niceties. The difference between programming
Python + Javascript. (Score:2)
Take Python and Javascript. Make it completely unlike them.
We talking syntactic sugar? (Score:2)
I'll actually answer the question (Score:2)
For a graphics engine, this would mean taking the art as the artists originally created it and doing all the processing needed to display it, every frame.
For a web browser, you would re-render starting with the HTML every frame
Computation creates entropy (Score:2)
If you had an infinitely fast computer you'd want to be outside it's lightcone so it doesn't vaporize you and everything around you.
Would not make much difference (Score:2)
The person that wrote this either never had a course in computability or failed it. The bottom line is that "infinite speed" does not matter in reality, because it turns out to be not the same as "infinite computing power". "Infinite computing power" is provable impossible, it leads directly to a contradiction.
Basically, you would not get much more than what current compilers are already doing, you would just not have to wait for it.
How do you make it easier and idiot-proof? (Score:3)
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.
If such existed. (Score:4, 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.
Re: (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?"
Re: (Score:2)
Re: (Score:2)
You still have to write the correct logic.
No you don't. An infinitely fast computer can instantly try all possible permutations of logic, and output the simplest program that meets the spec.
Re: (Score:3)
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
Re: (Score:2)
Re: (Score:2)
You should be punished for mentioning Paradox in a discussion of "ideal" programming languages.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Unless you use a programming language that lets you launch GC whenever it's most convenient (not too many do so). Bonus points if you don't need system specific behavior to get access to your own telemetry (which lets you time it properly.)
Re: (Score:3)
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!"
Re: (Score:2)
Re: (Score:2)
Wow, it's hard to explain how wrong you are. Literally the only thing I agree with is point 3.
I have programmed products, real complex products, in graphical interfaces. Where you create a loop like you suggested. It is hell. I can type far faster than use a GUI. And I can edit text at many more multiples faster. Whether "English" or not, most keyword sets are in the under 100/200 words, and the libraries will have to be named anyway. Make it Dutch, and I'll just learn a couple hundred Dutch words.
Co
Re: (Score:2)
One of the problem definitions was to increase human productivity. GC does this in spades. Is it any wonder why so many modern and high level languages have GC? Python. Java. C#. JavaScript. All lisps. Logic programming languages. CAS (computer algebra systems).
GC doesn't let the programmer allocate infinite memory any more than C lets you allocate infinite memory. The difference is that