[HN Gopher] AI converts between hundreds of programming languages
       ___________________________________________________________________
        
       AI converts between hundreds of programming languages
        
       Author : yodon
       Score  : 34 points
       Date   : 2022-09-29 20:48 UTC (2 hours ago)
        
 (HTM) web link (codelanguageconverter.com)
 (TXT) w3m dump (codelanguageconverter.com)
        
       | dleslie wrote:
       | I think I broke it.                   Input: TypeScript
       | Output: QuakeC         Code: Sample 3
       | 
       | 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.
        
         | UncleOxidant wrote:
         | 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.
        
         | adamwk wrote:
         | Prolog also seems to be broken; it keeps importing modules over
         | and over
        
         | mmarx wrote:
         | 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.
        
       | dkroy wrote:
       | 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.
        
       | arriu wrote:
       | Sample 2, typescript to c++: infinite loop. It just keeps
       | spitting out code
        
         | lofatdairy wrote:
         | 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.
        
       | version_five wrote:
       | 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
        
       | Sirened wrote:
       | finally: fully automated memory corruption
        
       | cleandreams wrote:
       | 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.
        
       | andrewstuart wrote:
       | Asking me to sign up just to give it a little try made be hit the
       | close tab button real fast.
        
       | awb wrote:
       | Interesting going from untyped languages to typed languages, as
       | an inference needs to be made.
       | 
       | For example, in JavaScript:
       | 
       | function add(a, b) {                 return a + b;
       | 
       | }
       | 
       | converting to Go, it becomes:
       | 
       | func add(a int, b int) int {                 return a + b
       | 
       | }
       | 
       | Where as the original JS version works with integers, floats,
       | strings, arrays, etc.
        
       | danielvaughn wrote:
       | I just want AI that will write a unit test for me.
        
         | hleszek wrote:
         | 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.
        
         | ben_w wrote:
         | I'm remembering a joke from my childhood.
         | 
         | 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.
        
       | MauranKilom wrote:
       | 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.
        
         | lofatdairy wrote:
         | At least the samples seem legit, in the sense that some break
         | the algorithm badly enough that we can be confident they
         | weren't hard-coded lol.
        
         | probably_a_gpt wrote:
        
       | aerovistae wrote:
       | Ah damn I ran out of free credits after like 2 basic runs.
       | 
       | 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.
        
       ___________________________________________________________________
       (page generated 2022-09-29 23:00 UTC)