
Show HN: Write code using natural language - tshepom
https://metacode.app
======
TBF-RnD
Okay so I came here expecring something different. Turns out that this is a
stack overflow search engine.

So ever since I read a book on AI I have been pondering on when and how
computers will steal our jobs.

I do have an idea on the subject though if anybody is interested in working
with me on this please comment: So with github and loads and loads of other
open source repos don't we have enough training data.

Couldn't throwing loads and loads of processing power on training an AI on
commits create an intelligence with an "actual" understanding of day to day
programming problems.

Love to discuss this please comment! Crazy idea but huge if it works!

~~~
YeGoblynQueenne
>> Couldn't throwing loads and loads of processing power on training an AI on
commits create an intelligence with an "actual" understanding of day to day
programming problems.

I'm curious to know why you think it's possible to create "an intelligence"
with "actual understanding" thanks to lots of processing power and data. What
makes you think this is actually doable? Do you think that this has been done
before, for example?

~~~
TBF-RnD
Okay so seeing how a brain is made up from 86 billion neurons. 16 of those in
the most recently developed cerebral cortex. Randomly creating a set of random
configuration of billions of neurons and then subjecting them to simulated
evolutionary evolutionary preasure on the basis of how close they come to A)
the correct solution B) compiling code that runs C) tests if available* Kill
of the worst performing networks. Mate the most succesful and have the
offspring replace those who where not fit enough for survival.

How would it work exactly, I wouldn't know which is sort of the point. But
sooner or later representations of abstractions within the code would appear
within the graphs.

I get that this is not either trivial and cheap. Let alone hosting the wast
amount of source code and parse it would require computing power weighing in
at quite a hefty sum.

Human beings probably have the advantage of having built in functionallity
that we are born with encoded in our DNA.

I suppose that a fair bit of "intelligent design" would be required. That is
having coded parses that breaks down the source code into input signals that
would help speed up the evolution.

Even reaching halfway there could be useful. Say by providing useful analysis,
maybe warn if something seem stupid. To some extent I believe that for a
natural language programming language to be viable some understanding of
abstract concepts have to be present in the algorithm. That's why I don't
think we'll ever program via speech recognition for example. Whenever Siri is
smart enough to parse what we are trying to do, why bother with programming.
Why not cut the middle man and plug her directly into Jira. but I'd love to be
proven wrong regarding this though.

I am by no means saying that it would be easy or even viable within the
forseable future. Thank God for that because that would means unemployment for
quite a few of us.

* As I am writing this it struck me that test driven development just happens to make this easier.

~~~
YeGoblynQueenne
>> How would it work exactly, I wouldn't know which is sort of the point. But
sooner or later representations of abstractions within the code would appear
within the graphs.

Sorry to be mean but all this sounds awfully confused and terribly hand-wavy.
It sounds like you think that stuff would just magically work like you want
it, if only you mix up enough ingredients (data, computation, neural networks,
evolution, abstractions, representations, graphs...).

Well, stuff doesn't just magickally work. Lots of people (like, literally
thousands) are training machine learning models and not a single model has
ever come close to "understanding" anything. I'd start from trying to figure
out why that is the case, and then see if something can be done about it.

Otherwise -and, sorry again, but- all these are mere time-wasting fantasies.

~~~
tracer4201
When op used the word “understanding”, I interpreted it as some program that
can provide code snippets, skeletons, or whatever abstraction in some
contextual way so it’s not just a dumb table lookup.

You’re post is unnecessarily pessimistic and generally bad faith.

And maybe ops vision can’t be realized today, but if someone is thinking
beyond the current state of the art, it’s short sighted and incredibly
ignorant to dismiss them as time wasting fantasies.

~~~
YeGoblynQueenne
Assuming the OP expects to gain something from this conversation, the most
benefit that can be gained is from telling them why their idea makes no sense.
_That_ is what "good faith" means and _that_ is what I did.

Your comment, on the other hand, seems to be confusing good faith with
indulgence. Just saying "yes" to people and being nice to them does them no
favours.

~~~
tracer4201
A discussion that makes us think about the boundaries of what is or isn’t
possible today is indulgence?

You failed spectacularly by your own definition of a good faith discussion by
dismissing ops post as “fantasy”. You give no explanation of why it is
unachievable today or why it would continue to be impossible in the future.

My previous team had a member who outright dismissed ideas and criticized
things for the sake of sounding intelligent without proposing solutions to
further the discussion or solve the problem. We let him go.

Good luck.

~~~
TBF-RnD
Thank you :D

Couldn't have written it better myself.

Maybe there is an minimal test case that could demonstrate deeper
understanding. Sort of a fizz-buzz for AI, to separate the parrots from the
thinkers so to speak. Food for thought. Meanwhile I am to busy on other
grandiose plans to give it to much attention ATM.

------
seisvelas
This seems more like a helpful glue between documentation and code than "write
code using natural language". Nevertheless, very cool!

~~~
carlmr
I was thinking more along the lines of natural language snippet creation. I
think one of the key problems here remains that you go from a ~30 word (+your
own identifiers) vocabulary to a English language vocabulary where you're not
sure how to express something.

The example says constrain x. I wouldn't have searched for constrain, but for
saturation, min-max, limit, or something along those lines. I'm not sure this
will work as well if you don't use the right vocab.

------
abecedarius
Is there a summary in text? I don't watch videos without a reason.

~~~
tshepom
I wrote a comment about how it works:
[https://news.ycombinator.com/item?id=19985482](https://news.ycombinator.com/item?id=19985482).
Will do a short blog post sometime soon.

~~~
abecedarius
Thanks!

------
matchbok
Cool experiment. Really shows how poorly conceived/verbose Auto Layout is. The
first thing I do in any iOS project is add some sort of wrapper around all
that constraint nonsense.

~~~
tannerc
Can you elaborate your approach? I've been making iOS apps for a decade now
but auto layout and constraints scare the bajesus out of me.

~~~
tshepom
Of course: the app draws from a database of thousands of snippets that are
cleaned up and generalized with some scripting. Natural language queries are
handled like search, with semantic matching over both natural language and
code structures. Content within the snippet like naming, "subject"/"target",
and values are dynamic (use # to modify those values) – but it still needs
work. As for auto layout, I actually have a feature for that on the roadmap
but wasn't sure it was a common problem – bumping up its priority!

~~~
zapzupnz
When GP asked for GGP to elaborate on their approach, I think they meant for
GGP to discuss their wrapper around constraints.

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

~~~
scotty79
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.

------
Wump
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)

------
marknadal
So this seems to be more like a natural search for code components? Does
anyone know if it is dynamic or using preset templates with adjustable
variables?

I did a talk out in Italy[1] where I showcased an evolutionary programming
language, one could take either symbolic input or fuzzy language input and it
would "reduce" it to a symbolic interpretation - which would be really
powerful for a non-programmer to slowly "learn" through interaction how to
speak / write code more precisely.

I'd love to see other demos people have, too!

[1]
[https://vimeo.com/208899228/b9bc9eaaa4#t=23m27s](https://vimeo.com/208899228/b9bc9eaaa4#t=23m27s)
(re-recorded for a webcast)

------
swlkr
Wow I really like this!

My main problem when programming against mac/iOS APIs is constantly looking up
how to do the little things shown in the demo video.

I don't look forward to writing macOS/iOS apps but this makes me think
differently.

~~~
epberry
I think you've nailed it. Getting all the constructs right can be tough -
Metacode solves that.

------
mistersys
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 the javascript tooling ecosystem it's hard to imagine going back
to the spaghetti I see with swift/iOS apps.

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

~~~
mistersys
A couple of days later... SwiftUI looks.. amazing.

------
matchbok
More evidence that iOS really just needs a declarative UI format.
Storyboards/IB are trash and doing it programmatically is fine, but slow and
error-prone.

~~~
Grustaf
If you think it’s trash it’s probably that you don’t know how to use them.
I’ve been making glorious UIs in IB for half a decade.

~~~
matchbok
I know how to use them just fine, thanks. Anything that cannot be
viewed/compared in version control or tested easily is trash. You cannot
easily collaborate on complex IB or storyboards.

------
king_magic
This looks pretty neat. Thought about something sort of like this awhile back
but never built it out, glad to see someone’s giving a try! Good luck!

------
aatharuv
Cool.

For an older implementation of programming using a natural language, there's
Lingua::Romana::Perligata
[http://users.monash.edu/~damian/papers/HTML/Perligata.html](http://users.monash.edu/~damian/papers/HTML/Perligata.html)

Unfortunately for probably most people here, the natural language in question
is Latin.

~~~
GorgeRonde

        nexto stringum reperimentum da.                     # $next = pos $
        nextum stringo reperimento da.                      # pos $string = $next;
        inserto stringum tum unum tum duo excerpementum da. # $insert = substr($string,1,2);
        insertum stringo unum tum duo excerpemento da.      # substr($string,1,2) = $insert;
        keyis hashus nominamentum da                        # @keys = keys %hash;
        keya hashibus nominamento da                        # keys %hash = @keys;

------
jason_zig
Nice landing page, it made it extremely clear what your product was and how I
might use it.

I'm usually skeptical about programming language abstractions but from the
demo it looks like this is more of a "helpful addition" then something you
need to fully commit to which is interesting. I don't do a lot of Swift but
will keep this in mind if I do. Best of luck!

------
carhartt
It's actually kind of cool to watch the animation, the tool maybe can help
teach people how to code in a much faster time-lapse way. I personally don't
know how to code in Swift but I think I learned a lot just watching the
animation and the different snippets. Maybe you can livestream your Metacode
app on Twitch for a learning channel.

------
DanielBMarkham
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 logical symbolic construct that
automates a sequence of interactions that pleases them. 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.

Neat. Best of luck, guys!

~~~
MuffinFlavored
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.

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

~~~
MuffinFlavored
did UML not work out? why not?

~~~
barbecue_sauce
Many people still use UML. It will always be there to use, whether or not it
"worked out".

------
dugluak
Visual Basic did something similar to Basic with drag and drop controls and
writing most of the UI code for you. This seems like a command line version of
same thing.

------
scotty79
I'd prefer it to be "Show HN: Communicate with humans by writing code instead
of using natural language"

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

~~~
tshepom
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!

------
injidup
This will just converge to some kind of lisp and then pragmatically end up as
XML and then be thrown away when it is realised it is a poor imitation html.

~~~
Tehchops
Is all "code of code" inevitably destined for a Lisp dialect?

~~~
cleansy
IMHO: There is a good chance that Lisp is pretty close to expressing "natural
language" in code. I would argue that written text / prose is even a bad
starting point. I'd rather think about having an UML Activity Diagram, add a
way to add parameters / variables to it. Then visually imagine that you take
away the full bubbles around the commands and just leave the sides. They look
like brackets, right?

Now fiddle in a syntax for having parameters, maybe place them next to the
text that describes what the program wants to achieve.

The next step is to define what the program or routine is actually doing, so
think about step one again.

... Every time I think about a non-graphical way of writing a program as
intuitive as possible I usually end up with some sort of Lisp.

EDIT: several edits for wording

~~~
tigershark
(Not (I think (really that (speak we (like this))))

~~~
codr7
It's more uniform, we use other forms of punctuation in writing.

Spoken programming languages is a different can of worms.

------
guiltygods
Only Swift or it can handle any language ?

~~~
tshepom
Yup, just Swift right now, but collecting requested languages here:
[https://forms.gle/Yfgxn3yi4JHvjmD17](https://forms.gle/Yfgxn3yi4JHvjmD17)

------
AdmiralAsshat
Project will end when it discovers it has reinvented HyperCard.

~~~
zapzupnz
It's a snippet program. It's not trying to reinvent anything.

------
faissaloo
If you want to understand why this is bad just look at AppleScript, probably
the closest thing I've ever seen to natural language, the only problem is that
it's impossible to just figure something out if there isn't a tutorial,
because there's no real convention you can make guesses based on.

~~~
tshepom
Ah, interesting! The difference between Metacode and something like
AppleScript is that the artifact left over from using Metacode is still the
rigorous programming language you're used to. If we retain a query log, you
could even convert your natural language queries into code comments alongside
your code to actually improve clarity.

~~~
pvg
You're going to get a lot of comments like these because when you say 'natural
language' and 'programming' or 'code' in the same sentence people think coding
directly in some 'natural'-like language. Also people often don't click on the
actual links and many don't necessarily watch endlessly looping video clips
when they do. A little bit of verbiage on the site might help that and head
off the more obvious-but-inaccurate critiques. .

------
max0563
The problem with this kind of stuff is that by due to the ambiguity of natural
language, it becomes more complicated to actually do this at scale.

Also, you are essentially creating another programming language that I have to
learn and I don't want to learn it.

"Writing code using natural language" should mean that I can write code
without having to follow any kind of format.

I should be able to say "find the smallest item in the list" and "give me the
smallest element in the list" and that should work the same way. Right now
these natural language programming languages are still just that - programming
languages.

------
jasode
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...](https://stackoverflow.com/questions/tagged/git?sort=votes&pageSize=15)

[1] [https://stackoverflow.com/questions/927358/how-do-i-undo-
the...](https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-
recent-local-commits-in-git)

[2] [https://docs.microsoft.com/en-us/visualstudio/ide/code-
snipp...](https://docs.microsoft.com/en-us/visualstudio/ide/code-
snippets?view=vs-2019)

~~~
llaappqq
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.

~~~
Aeolun
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.

------
llamataboot
My "first" programming language other than BASIC as a kid was probably
learning Inform to create interactive fiction with

[http://inform7.com/](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 "stepmother" as
the old lady. The old lady is active. The description of the lady is "She
looks plucked: thin neck with folds of skin exposed, nose beaky, lips white.
Perhaps when her fortunes are mended her cosmetics too will improve.""

\---

And it obviously gets more complex as you create things like objects with
weights and inventory limits etc. My experience of it is that when it worked
it was pretty magical, but when it didn't it was utterly maddening to figure
out how to get it to parse.

Kinda felt like a voice help that barely works.

Best of luck with this, I like where it looks like it is going, but it simply
has to be /really good/ to be value-added and not frustration-added

~~~
pushpop
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.

~~~
llamataboot
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!

------
throwaway55554
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?

~~~
The_rationalist
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

~~~
SilasX
>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.

~~~
_emacsomancer_
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.)

------
Wowfunhappy
One of the things I really like about Applescript is that, at least for simple
tasks, the code reads as standard english. This isn't to say you can type
anything in english and Applescript will interpret it, just that the correct
syntax also happens to form real sentences.

Here is how I tell QuickTime to play NPR:

    
    
      set WNYCAddress to "http://www.wnyc.org/stream/wnyc-fm939/aac.pls"
      tell application "QuickTime Player" to open URL WNYCAddress
    

Here is how to tell if the file you've highlighted in Finder is on a specific
drive:

    
    
      set theNameOfTheDrive to "Archive"
      tell application "Finder" to set theSelectedFile to the target of the front Finder window as text
      if theSelectedFile starts with theNameOfTheDrive then log "that file is on the right drive!"
    

Unfortunately, it all starts to break down when you get to more complicated
stuff, but in the right situations it's kind of beautiful. I wish Apple had
taken it a bit further...

~~~
microtherion
Wicked tongues have called AppleScript "Visual COBOL".

~~~
Wowfunhappy
Are we just comparing any old-ish languages we don't like to COBOL now?

Applescript has its problems but it's one of my favorite features in macOS.
Maybe not the language itself, but the Apple Events capability. There's no
equivalent in Windows other than AutoHotKey type stuff.

~~~
microtherion
For AppleScript, the analogy seemed apt, as both AppleScript and COBOL set out
to design a syntax resembling conversational English more than a typical
programming language would.

~~~
Wowfunhappy
Thank you, I've never actually seen COBOL code (presumably a good thing...)

