Live data from Hacker News

Generating code from natural language is closer than you think

blog.stephenwolfram.com

11–20 of 83 posts

Re: Generating code from natural language is closer than you think

#11
post #9

While it would be neat to give the power of programming to everyone, I'm not convinced coding in a natural language would necessarily be better/easier than writing code in Ruby or Lisp or Python. Sure, you eliminate the first big hurdle in programming, but learning the syntax of programming language is usually one of the easier parts of software development.

"Draw a red circle" is enough to get a red circle. Basic, C++, or Javascript just aren't that closely coupled with the way we think.

The advantage of natural language over a high level programming language would appear to be analogous to that which a high level programming language has over assembly.

I think you may be conflating programming with software development. People still develop software in assembly language, but few people use it in lieu of javascript on the web.

Re: Generating code from natural language is closer than you think

#12
post #8

This is in the class of "demoware", projects that are easy to program fancy demos for but are very difficult to bring to production status. (See also: "fully visual programming".) It's only really interesting if they escape from that. We'll have to wait and see.

There is a difference between visual programming and natural language.

Natural languages already have tokens, syntax, and grammar whereas visual fields do not have them. All those elements must be imposed onto a visual language before it can be translated into the machine language (e.g. there is no obvious convention for visual commands or visual conditionals).

Re: Generating code from natural language is closer than you think

#13
post #3

A related thought experiment: if programmers were to work for free, would non-programmers think up of lots of clever things for them to build?

This is a great point.

After a few minutes of thought, the biggest benefactor of natural language coding would be what I'd call late-bloomers: people who always thought like coders, but never actually did programming.

Re: Generating code from natural language is closer than you think

#14
post #9

While it would be neat to give the power of programming to everyone, I'm not convinced coding in a natural language would necessarily be better/easier than writing code in Ruby or Lisp or Python. Sure, you eliminate the first big hurdle in programming, but learning the syntax of programming language is usually one of the easier parts of software development.

"Draw a red circle" is enough to get a red circle. Basic, C++, or Javascript just aren't that closely coupled with the way we think. The advantage of natural language over a high level programming language would appear to be analogous to that which a high level programming language has over assembly. I think you may be conflating programming with software development. People still develop software in assembly languag…

> "Draw a red circle" is enough to get a red circle.

Yes, but once you have to say "Draw a circle in this shade of red, give it a black border this thick, make it this big and put it at these coordinates" things are starting to get unwieldy. After a few different circles I'd probably start longing for draw_circle(fill_colour, radius, (x,y,z), border_colour, border_width).

Edit: Added function arguments to make the comparison less biased.

Re: Generating code from natural language is closer than you think

#15
post #9

While it would be neat to give the power of programming to everyone, I'm not convinced coding in a natural language would necessarily be better/easier than writing code in Ruby or Lisp or Python. Sure, you eliminate the first big hurdle in programming, but learning the syntax of programming language is usually one of the easier parts of software development.

"Draw a red circle" is enough to get a red circle. Basic, C++, or Javascript just aren't that closely coupled with the way we think. The advantage of natural language over a high level programming language would appear to be analogous to that which a high level programming language has over assembly. I think you may be conflating programming with software development. People still develop software in assembly languag…

Where is the red circle drawn? How large is it? What shade of red? How are those arbitrary values chosen, and how do I choose others?

The inherent problem with NLP is that human languages are imprecise and ambiguous. For an example of the problems with NLP, try using Wolfram Alpha. While it returns useful results for many queries, as soon as you start off the beaten path it can become an exercise in frustration as you try to figure out exactly which format of words it will accept, especially as I know the mathematica command that would accomplish the desired goal (or can look it up quickly).

Obviously Alpha isn't the end-game of NLP and improvements can be made to accept more constructions. But ultimately, you're going to have to restrict yourself to a subset of your natural language's syntax, grammar and vocabulary, and I believe that learning what that subset is is far more difficult and frustrating than just learning a programming language.

Furthermore, merely knowing a NL programming language isn't enough to be a programmer--you still need to learn how to think logically and algorithmically, which seems to be the hard part for people new to programming.

Re: Generating code from natural language is closer than you think

#16

Well, I since it isn't possible (natural language isn't precise enough to even communicate efficiently with other humans that share the same hardware as you, much less an unthinking autamoton such as a computer), that would put the time frame at around never. If it ever actually happens, that would by definition of 'never' be sooner than I think, so all he has to do is actually accomplish it instead of talking shit h…

Programming languages are specificational: you say everything up-front, then the computer interprets all your statements at once and executes them.

Natural language, however, is conversational. You say A, the person you're talking to interprets that as Z and asks for clarification, you explain the difference between A and Z, now the other person thinks M and asks more clarifying questions, etc.

Computers are fully capable of working conversationally, instead of specificationally; it just requires that instructions be stored in a form that's a bit more complicated than a linear tape (e.g. a database of constraints, like Prolog.)

Re: Generating code from natural language is closer than you think

#18
This is clearly demoware, good enough to impress the general public. But once you go from "Draw a red circle" to "Draw a red circle overlapped one third with a blue square with white dots over the lower left corner" that would be progress. And then I wonder if this will also work: "Paint a white-dotted blue square that intersects over a third of a red circle in the lower-left corner. Or will it give a "compile error"

Why not just create a DSL (e.g. in Scala) with a simple standardized NL-like syntax that can give meaningful "compile errors". There is no need to impress the general public.

Re: Generating code from natural language is closer than you think

#20

I would be fascinated to see several hundred years down the road how natural languages and computer languages have comingled and evolved into something new. I'd be inclined to believe that bringing natural language to computers won't just be a one-way street. You already see this in places like hacker news here where people often use constructs like "s/thing/other thing/" because it's more concise and useful than wri…

I upvoted you. But I am not sure that "/thing/other thing/" is more concise or useful than all alternatives.

"thing" → "other thing" is the same length, and while not natural language, it isn’t a computer language.

I think using the sed-like (right?) language is more useful as a signaller. Check it out, yo, I grep shit all the time.

Post reply on HN