Live data from Hacker News

Show HN: Write code using natural language

metacode.app

61–70 of 118 posts

Re: Show HN: Write code using natural language

#61

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?

I don't believe there is a natural grammar that is unambiguous, instead I think in the realm of computer languages it's more a process of creating a jargon set that relates to terms but explicitly overrides them with unambiguous meanings within the domain.

For instance `new Object` - we're all going to read that as "create a new object that hasn't existed before" but within english a `new Object` could also be an antique you happen to have recently acquired, so `new` could be comprehended to be an acquisition action - like copying an Object - rather than creating a new one... But in our fancy computer language jargon we have forever banished the "new to me" meaning from `new`.

Re: Show HN: Write code using natural language

#64
post #51

Very cool! Do you have any ideas for how to document the tool well? Thank you for the smile this brought to my face :). Really imaginative and cool tool.

Not yet, right now I just have a tutorial window that shows up the first time you use the code builder feature, and the videos on the home page. Open to suggestions!

Re: Show HN: Write code using natural language

#65

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 so…

Isn't that what UML was supposed to be for?

Re: Show HN: Write code using natural language

#66
post #30

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

>Only a Subset of features of natural langage introduce ambiguities, equivocations, et I wish! People won't even use "literally" consistently, despite it existing to prevent you having to guess which sense a speaker means. Edit: Toned down.

People love to pick on the intensive meaning of "literally", perhaps because it is more recent, but it's really not much different from the range of uses of "really", which also can mean both 'in fact, truly' as well as an intensifier sense like 'very'. E.g. "I was really shocked", "I was literally shocked" have similar ambiguities. Competent human speaker generally provide enough context that potential ambiguities aren't too problematic -- for other human beings, if not for machines.

Human languages are more ambiguous than you might imagine, and lexical things like 'what meaning of "literally" is the speaker using' are pretty tip-of-the-iceberg stuff. (Think about what "Every man wants to read some book" or "the girl saw the man with the binoculars" (can) mean.)

Re: Show HN: Write code using natural language

#67

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?

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

Well, lojban tried.

https://en.wikipedia.org/wiki/Lojban

Re: Show HN: Write code using natural language

#68
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…

> One way to look at Stackoverflow is that it's a gigantic index that maps "intuitive plain English" to "non-intuitive exact syntax".

It's not that syntax itself isn't intuitive; there's after all nothing more intuitive than, say, FORTH, LISP or Haskell syntax - surely it handily beats the weird idiosyncratics of "more English-like" FORTRAN or COBOL! It's actually the semantics of what you're interacting with, that, while simple, might be initially unintuitive to a naïve user. I don't think that I'm actually disagreeing with what you're saying; it's just that "not knowing the exact syntax for X" generally unpacks to something slightly different, namely "not knowing the relevant semantics to the extent that one can figure out how to do X". This, I think, is a better explanation of how StackOverflow might end up being quite helpful.

Of course, natural language itself does involve some semantics-related facets of its own, that might well end up being more intuitive than the programming-language semantics we normally use. But even then, we can (and should) use devices like Montague-semantics to give them an "intuitive", compositional syntax reminiscent of the lambda-calculus, Haskell or FORTH. I think this is the better way towards the goal of "using natural language to make programming more intuitive".

Re: Show HN: Write code using natural language

#69

Really awesome stuff for dealing with verbose frameworks. In the code builder demo, it strikes me that all that code in swift could be replaced with a declarative format: let TestVC = viewController( button( padding: { left: 5 }, width: 100, height: 200 ) ) And probably be easier to type than these snippet demos. Has there emerged a good declarative API for iOS? As a web developer, as much as I hate the insanity of t…

That would be awesome! But yeah nothing like that for iOS comes to mind.

Re: Show HN: Write code using natural language

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

Right away? Or when you actually need to do the thing?

When I start using anything new I really only check that it can do what I need it to, not everything that’s possible.

Post reply on HN