Live data from Hacker News

Show HN: Write code using natural language

metacode.app

51–60 of 118 posts

Re: Show HN: Write code using natural language

#52
post #41

My "first" programming language other than BASIC as a kid was probably learning Inform to create interactive fiction with http://inform7.com/ It was a pretty complex language, and meant to use English syntax to mix both the fiction writing and the coding. So you can end up with code that looks like the following, for example --- "Stage is a room. The old lady is a woman in the Stage. Understand "mother" or "stepmothe…

This tool is almost, but not quite, entirely unlike Inform, though. The 'programming' part is still done in a regular old language like Swift. The tool finds and/or generates snippets for you and plonks them into the Swift code you're actually writing.

yes, I see that, I should have been more clear that I knew it was a separate domain. This looks more like extended and interesting macros. My only point was that when you move towards being able to express things in natural language - whether as programming or even getting Siri to call your friend, the frustration level can be much higher if it doesn't work as expected.

There is something about getting to talk in "natural lanaguge" some of the time, and otherwise having to repeat yourself while trying variations in syntax that just feels bad.

Since I was talking about Inform, probably analogous is the text adventure issue where you know /how/ to solve the riddle, but you don't know how to tell the machine that you know.

"Give lantern to crocodile" "Offer lantern to crocodile" "Put lantern on crocodile" etc

Re: Show HN: Write code using natural language

#53
post #47

My "first" programming language other than BASIC as a kid was probably learning Inform to create interactive fiction with http://inform7.com/ It was a pretty complex language, and meant to use English syntax to mix both the fiction writing and the coding. So you can end up with code that looks like the following, for example --- "Stage is a room. The old lady is a woman in the Stage. Understand "mother" or "stepmothe…

I’m someone who picks up new languages easy - regardless of their paradigm - and this is honestly the first time I’ve spent 10 minutes going through a languages documentation and still not been any wiser where to start. That is an extremely odd programming languages; fascinating too. Kudos for actually being able to use it.

The docs are actually amazingly comprehensive, but it does have a pretty steep learning curve, especially as it is presented towards non-programmers, so you can't nec look up how to do a conditional very easily.

However, what really shines are the tremendously well documented full games. You can literally load them in Inform and play the game in one pane and walk through the code in the other.

I'm still not sure what to think of it as a language, I think now as a full-fledged programmer, I would pick an interactive fiction framework that looks a lot more like a programming language and less like fiction. However as a beautiful experiment in being able to use the English language to write a story and make it playable at the same time, it is still pretty amazing to me.

It /is/ a full-fledged language. You can implement weather or tides or magical systems or inventory systems or health points or anything else you can thing of, but it all reads pretty English-y...until it doesn't!

Re: Show HN: Write code using natural language

#54

In a tightly-scoped domain like "write code in Vue.js" it might be really cool. Looking forward to seeing how this evolves! But just like self-driving cars, once you start expanding the scope, and only just a little bit, it doesn't look so cool anymore. I would love to see how far they can take this. Programming in the purest sense is taking problems that real people have, expressed in their own words, and creating a…

But just like self-driving cars, once you start expanding the scope, and only just a little bit, it doesn't look so cool anymore. I would love to see how far they can take this.

It's beautiful the way you balance the pessimism of hard experience with an optimism borne of real natural language understanding being still an amazing possibility.

Human language is an extremely fuzzy and messy affair involving all sorts of things like body language that don't transfer to writing. Programming is not like that. These are not just different things. These are completely different domains of things.

That's rock such hopes founder on, sadly. Of course, there's always a chance someone will the passage between things that others have missed.

A more hopefully way to put is that natural language is a stream of symbols that where the unnecessary parts are removed, the other parts are actively interpreted by context and by the intent of the speaker, and where any ambiguity is sorted out by dialog. If you can create a system that can let you program similarly, you may have something.

Good Luck again!

Re: Show HN: Write code using natural language

#55
I gave it a try; love how fast and simple it is! You probably already know this, but the set of snippets are somewhat limited at the moment (though pretty good for a first launch). Also, it would probably be helpful to have more descriptions/metadata around each snippet, so that you can use some NLP goodness to make search better.

I've been working on a related idea, which is sort of a search engine for programming questions integrated into your IDE (starting with JS in VSCode). The idea is to give you fast, relevant answers (code snippets when possible), and reduce context switching to the browser to keep you in flow.

Similar in spirit though; would love to chat more! (my contact info in profile; I didn't see a way to contact you)

Re: Show HN: Write code using natural language

#56

Natural language is ambiguous. Grammars for computer languages are designed to remove ambiguity. A natural language that is used to program a computer, too, will have to remove ambiguity, thus only using a severely constricted subset of a natural language. Is it worth it beyond curiosity? If a person can't grok a computer language are they going to grok such a terse natural language?

It's not actually a "natural programming language", it's more of a snippet generator. The output is ordinary code and you still have to understand it.

I can see how this would be useful to quickly get the right incantation in certain verbose APIs, as opposed to copy-pasting code from API docs or Stackoverflow.

Re: Show HN: Write code using natural language

#57
post #29

Earlier quoted context omitted.

Ruby on Rails is designed to add it right back in. "Cookies set? Oh, that must be the plural of Cooky" -> actually happened in live coding demonstration before.

Or my favorite example: that at one point, the Rails inflector would singularize "police" as "polouse."

Everyone once in a while a product manager will get familiar with the Django admin page of an app I'm working on and say something like "What? Why does it say Companys? Is there something wrong with the app?"

My response is always (some diplomatic, lay version of), "No, it's correctly refusing to involve us in the game of guessing how the framework developers modeled plurals."

Re: Show HN: Write code using natural language

#58
post #42

One way to look at Stackoverflow is that it's a gigantic index that maps "intuitive plain English" to "non-intuitive exact syntax". A good exampe of bridging this mismatch is "git" commands. A lot of questions about Git are just translating natural English into the "secret decoder ring" lingo of Git.[0] E.g. "How do I undo a commit?" isn't something obvious like "git undo" . Instead, it's the more cryptic "git reset…

100% agree with this take. I mentioned it in another comment, but I've actually been working on a project which is essentially a better search engine for programming questions that's integrated in your IDE.

When possible, you try to pull out code snippets from SO/github/reference sites/etc that answer the query with high confidence. (Essentially like "instant answers" in google, but making it better by focusing on programming questions.)

The challenge is the level of noise and ambiguity that you get back in search results, and actually sorting through that to surface the right answers.

Re: Show HN: Write code using natural language

#59
post #42

One way to look at Stackoverflow is that it's a gigantic index that maps "intuitive plain English" to "non-intuitive exact syntax". A good exampe of bridging this mismatch is "git" commands. A lot of questions about Git are just translating natural English into the "secret decoder ring" lingo of Git.[0] E.g. "How do I undo a commit?" isn't something obvious like "git undo" . Instead, it's the more cryptic "git reset…

I agree that a lot of the unremovable difficulty in programming is translating natural English into something precise.

But I also think git often makes the problem worse by splitting similar operations unnaturally across different commands. I believe that was the motivation behind mercurial.

Re: Show HN: Write code using natural language

#60
post #42

One way to look at Stackoverflow is that it's a gigantic index that maps "intuitive plain English" to "non-intuitive exact syntax". A good exampe of bridging this mismatch is "git" commands. A lot of questions about Git are just translating natural English into the "secret decoder ring" lingo of Git.[0] E.g. "How do I undo a commit?" isn't something obvious like "git undo" . Instead, it's the more cryptic "git reset…

Except languages are ambiguous. When you say you want to undo a commit, do you mean undo like pretend nothing had happened or undo but please keep track of the change.

That's why the first thing I do when I'm learning something new is to read the documentation to find out what capabilities are available.

Post reply on HN