Live data from Hacker News

Show HN: Write code using natural language

metacode.app

41–50 of 118 posts

Re: Show HN: Write code using natural language

#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.

Re: Show HN: Write code using natural language

#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 HEAD~"[1]

A lot of the programming grind is like that. You know the English words for what you want to accomplish but don't know the exact programming syntax to make it happen. So this app is sort of like putting Stackoverflow lookups with copy&paste directly into the IDE.

In contrast, the existing "insert snippets" functionality in Visual Studio[1] or IntelliJ have abbreviations to help find templates of code but not quite the rich natural language of Stackoverflow. I wouldn't be surprised if future versions of those IDEs incorporate something like Metacode.

[0] so many "How to...?" in the most-upvoted questions tagged [git] : https://stackoverflow.com/questions/tagged/git?sort=votes&pa...

[1] https://stackoverflow.com/questions/927358/how-do-i-undo-the...

[2] https://docs.microsoft.com/en-us/visualstudio/ide/code-snipp...

Re: Show HN: Write code using natural language

#43
post #36

Using NL as a macro system for quickly inserting code, instead of as a way to hide actual code, seems like a good use-case. I wish the website was more informative about how much you can do with it, how far it goes to automatically generate snippets, and what kind of language support it's planned to have.

Normally I'd be very sceptical but this just seems like a shortcut to googling the thing you need from stackoverflow and shortcuts are nice.

Re: Show HN: Write code using natural language

#44
post #35

Earlier quoted context omitted.

Only a Subset of features of natural langage introduce ambiguities, equivocations, etc. It is perfectly doable to force one and only one meaning per keyword (just like do programming keywords already (if, while, etc), removing the ability to use coreferences, etc I would love to see a great constrained English, formal without the readability and expressivity loss of formal symbolic grammars / formal maths

Sounds like you are looking for Legal-ese.

Even legal-ese can be ambiguous. If it weren't then courts would never overturn other courts' rulings.

Re: Show HN: Write code using natural language

#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.

Re: Show HN: Write code using natural language

#48

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…

I toyed with the idea that corporate business analysts (who write requirements for products then hand to developers) could just write in a different syntax and pass them to a compiler that makes:

1. database tables

1. API CRUD endpoints with validation / sanitation

1. screens with input fields

Most of the corporate work I did was very similar to this. It was either a batch job, a UI screen, or an API that talks to some other service.

Re: Show HN: Write code using natural language

#49

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?

'Remove ambiguity' means 'choose a meaning', which of course means non-zero% chance you're wrong.

Alternatively, as you said, use a non-ambiguous subset. But then it's no longer a natural language, I wouldn't mind betting they're all ambiguous.

Re: Show HN: Write code using natural language

#50
post #29

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?

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."
Post reply on HN