Seems to spin forever. (Which makes sense, as QuakeC is incapable of the constructs in Sample 3).
Edit: after a few minutes spinning it's... Spewing a lot of nonsense. It seems to be dumping every variable combination it can "think" of that it has seen in QuakeC.
I think maybe they're being a bit too ambitious by trying to cover so many languages. Obscure languages won't have nearly as many examples to train on.
TypeScript to Fortran is also broken, generating lots of dlopen/dlsym/dlclose calls (one for every variable, it seems), but never actually doing anything else with it.
For what it's worth, Sample 2 generates syntactically invalid code, having `:` instead of `::`. Sample 1 is actually working code (but relies on the implicit typing rules, which gives you the default real kind instead of double precision reals). Interestingly, translating Sample 1 from Rust to Fortran suddenly generates a subroutine instead of a function, but does generate types.
Just tried the default example from C to Forth. It gave an answer but also appended two other commented Forth functions to it.
Also, this almost immediately adds a signup wall not for the real product, but to the little demo box on the home page that makes it not worth playing with
Tried pasting a big piece of code. "Whoah, that's big, try something smaller." Ok, paste small snippet of code. Click "translate". "Sign up first". Urgh, fine, this looks just about exiting enough to try, but barely so.
After signing up, I have zero credits, without a single translation performed. I mean, not that I expect free lunch, but I'm also not gonna pay money before seeing a single 10 line example.
It’s not going to rewrite the huge web of dependencies that any given app consists of, nor will it recreate the various differences between runtime environments for interpreted languages.
It’s essentially a cute party trick.
Stuff like copilot is where I see the utility in the space.
There are some bits that just simply cannot be translated. For example, you can’t just “translate” a stdlib function from a high level language into a low level language, there’s likely no comparison in the low level language.
I was about to come back to this thread and post almost the exact same comment. I didn't even get 10 lines - I just converted the 3 line typescript example that was already there, and couldn't try anything else. There's no way I'd ever pay for this.
What a good idea! It could also relatively easily verify if it's correct and only return a result when the test is passing and all the lines (or even paths) are covered.
When trying Sample Code 3 converting the TypeScript to Python the conversion was incorrect. Probably worth swapping that out for another sample if the owner is in this thread. As I was writing this I noticed that this wasn't a Show HN post.
What's weird is that it starts generating a function to print out its parameters in ts then immediately translates it to cpp, both initiated with comment lines which seems similar to copilot.
I have written translators and they are really hard. I think training on code bases is the way to go but I am skeptical overall that it is even worth the effort. The problem is that the translation doesn't get you all the way there. The code produced is buggy and wrong in most cases. You probably get a better result from re-designing and re-implementing.
I wonder what the data being trained on even is. It has to include successful translations, right? There are not many of those. Not enough for a good result.
I think it depends on how urgent the migration is, and how much you're paying to fix the bugs.
If the systems works functionally but the infrastructure (?) hasn't aged well, and there's only time / budget to switch horses, that might be the sweet spot.
I’ve written translators that also had to consider pattern changes. The amount of training to translate code effectively is enormous to be effective at scale. I assume this is segmenting separate models based on each language permutation.
I would love to see AI applied to predict algorithms and provide intelligent recommendations.
Writing code is rarely the problem anyway. Understanding the problem and devising a suitable solution given the full context is where the magic is. And since most humans have a hard time even accurately describing a problem and full context, there's no threat that AI will replace developers.
If we can build up an immense library of clearly defined problems and solutions, with variants which fit with all conceivable unique contexts, then maybe it will become possible for AI to provide useful assistance.
It would be a good goal to do what I describe, as it would result in many fewer bugs in software. The risks then would be either misidentifying the problem (and therefore getting a solution which doesn't fit the need) or providing inaccurate context which allows for suboptimal selection of a predefined solution.
> If we can build up an immense library of clearly defined problems and solutions, with variants which fit with all conceivable unique contexts, then maybe it will become possible for AI to provide useful assistance.
Agreed. What you're describing (an immense library of problems and solutions) is essentially what's in the head of a very experienced developer. A system that helped surface those in a simple way for "new" problems so that people aren't constantly reinventing the wheel and making the same mistakes would be great. I've seen ideas about similar "tacit knowledge" systems in other domains (though I'm not sure there is a good one yet). For software, such a system would be way more helpful, and a much better goal, than this kind of idiot-savant gpt stuff
It still won't help with setting up the development environment to be able to compile rust of the week or c++??. Both of which have dev communities which adopt forwards incompatible features fairly rapidly so the environment in your distro probably won't work as is. But eventually, maybe they AI will set that up too, https://www.commitstrip.com/en/2019/03/15/css-css-everywhere...
Programming is 10-20% of the job, sure it's fundamental but even if an AI could generate optimal code solutions for most use cases it'd still never replace us...
I had a particularly funny result: Trying sample #3 (put a record into S3) from Typescript to Python, it reliably... outputs a completely different program, which instead downloads an image from S3 and resizes it in /tmp. Weird.
Ditto for converting sample #3 from Python to Rust...it doesn't even try to interact with S3 at all, it just saves the image to a path specified in args (twice, overwriting the first image). Also, the comments it writes are incorrect.
Seems completely broken now; like others, I tried to test something, found I had to sign up, signed up, and found I have "0 free credits".
I really wanted to see what it was gonna do for Python -> C++ converting some nested dictionary and list comprehensions:
def foobar(x, y):
return {
_: __
for _, __ in zip(
[_ for _ in x if _ in y],
[_ for _ in x if _ not in y]
)
}
{3: 1, 4: 2} == foobar([1, 2, 3, 4], [3, 4, 5, 6])
You can accomplish something close to this with GitHub Copilot (or OpenAI Codex), just write some code in a comment and then say “rewrite the above (language) code in (language)”. Typing the first few characters of the converted version yourself helps with accuracy.
I applaud the effort of whoever put this together, but it is a toy, and a broken one at that. Trivial examples break it easily. When an "AI" like this can take 5,000 lines of SAS in a single file where execution starts at the top and finishes at the bottom with nary a function or external module to be found written by a government employee who hates his job and really doesn't think you should be reading his source code and can turn it in to comprehensible Python that is readable I might be interested. But this is most likely going to be a case of GIGO.
59 comments
[ 2.6 ms ] story [ 47.1 ms ] threadEdit: after a few minutes spinning it's... Spewing a lot of nonsense. It seems to be dumping every variable combination it can "think" of that it has seen in QuakeC.
For what it's worth, Sample 2 generates syntactically invalid code, having `:` instead of `::`. Sample 1 is actually working code (but relies on the implicit typing rules, which gives you the default real kind instead of double precision reals). Interestingly, translating Sample 1 from Rust to Fortran suddenly generates a subroutine instead of a function, but does generate types.
Definitely not enough of a taste to convince me to spend money on this. Might want to adjust that freemium model.
It's a cool idea for sure and could definitely be useful though.
Also, this almost immediately adds a signup wall not for the real product, but to the little demo box on the home page that makes it not worth playing with
After signing up, I have zero credits, without a single translation performed. I mean, not that I expect free lunch, but I'm also not gonna pay money before seeing a single 10 line example.
It’s not going to rewrite the huge web of dependencies that any given app consists of, nor will it recreate the various differences between runtime environments for interpreted languages.
It’s essentially a cute party trick.
Stuff like copilot is where I see the utility in the space.
For example, in JavaScript:
function add(a, b) {
}converting to Go, it becomes:
func add(a int, b int) int {
}Where as the original JS version works with integers, floats, strings, arrays, etc.
Guy is in a computer store. Salesman says “This will halve your workload”. Guy says “Great, I’ll buy two!”
We’re nearly there now.
I wonder what the data being trained on even is. It has to include successful translations, right? There are not many of those. Not enough for a good result.
If the systems works functionally but the infrastructure (?) hasn't aged well, and there's only time / budget to switch horses, that might be the sweet spot.
I would love to see AI applied to predict algorithms and provide intelligent recommendations.
If we can build up an immense library of clearly defined problems and solutions, with variants which fit with all conceivable unique contexts, then maybe it will become possible for AI to provide useful assistance.
It would be a good goal to do what I describe, as it would result in many fewer bugs in software. The risks then would be either misidentifying the problem (and therefore getting a solution which doesn't fit the need) or providing inaccurate context which allows for suboptimal selection of a predefined solution.
Agreed. What you're describing (an immense library of problems and solutions) is essentially what's in the head of a very experienced developer. A system that helped surface those in a simple way for "new" problems so that people aren't constantly reinventing the wheel and making the same mistakes would be great. I've seen ideas about similar "tacit knowledge" systems in other domains (though I'm not sure there is a good one yet). For software, such a system would be way more helpful, and a much better goal, than this kind of idiot-savant gpt stuff
...probably.
return a if b.zero?
return b if a.zero?
a + b
end
Now lets see elixir :)
I say the trial should allow at least one bit of code that we provide.
At best I'd get Ruby code with elixir syntax.
Programming languages require thinking about memory and code differently. That's why we have them.
I'd be interested to see this in elixir :)
while (s++ = t++);
I really wanted to see what it was gonna do for Python -> C++ converting some nested dictionary and list comprehensions:
Like demanding an email address to tell someone the punchline to your joke.
So I guess... this spells doom for the quants but the scientists can sleep soundly.
Clearly not ready for prime time.
// TODO: Translate the above Rust into CHIP-8
### TODO
and now it got stuck on emitting some assembly. I don't exactly know what because CHIP-8 doesn't have an assembly representation.
It printed this 16 times