I can't imagine this working out for producing idiomatic code, especially between very divergent languages like Haskell and C++. Their example is almost straight syntactic replacement, not very impressive. And their real-world use-case is for migrating COBOL projects to python??
Facebook as a company do not believe in ever rewriting large code bases. You can view lots of their open source/technical achievements as out growths of this belief: - 2004, write PHP as it's fastest for now - 2008: PHP is too slow, compile it to C++ - 2011: C++ is too slow, write a VM and compile to assesmbly - 2012: PHP's type system sucks, write a better typer in OCaml (Hack) - They have done much the same for Jav…
Deep learning to translate between programming languages
31–40 of 81 posts
Re: Deep learning to translate between programming languages
#32Also as a programmer your mental modal is completely out of sync, how do you work on such application suddenly now that its all in Python (coming from C++)? Or is this shipped to a new team which received 100 000 lines of C++ but no clue how it all works?
How would FB use this at all?
Re: Deep learning to translate between programming languages
#33This sounds more impressive than it is. I kept an auto-translation going for quite a while from C# to Go just by creating some bash scripts. These languages are so similar, that while not idiomatic, you can be up and running with quite few rules and some simplifications to the original code. While I believe this is a good arena for algorithms to provide solution, I'm sceptical that ML in its current incarnations is t…
Not sure though, I’m not an expert in LLVM IR, so I’m not sure how feasible that is...
Re: Deep learning to translate between programming languages
#34Earlier quoted context omitted.
That'd be truly remarkable as in actual magic. Take this rather simple example: PointList interpolate(PointList sample_points, OrderedRealNumberList points_to_interpolate); This function can be auto-documented from its name and the names and types of its arguments alone. No ML required - simple pattern matching and LUTs will do. But then again, do you really need a detailed documentation in such case? Where a documen…
Guessing !! N,X, and F are probably related to NE,XE, and FE "E" means "error"? Maybe. IERR is an error flag. Idiomatic fortran there. Each of those variables will be defined later on, in the code. at least with a type (not required, but it is not 1960 anymore). In that declaration is where some comments would be. REAL*8 N ! Radius of the body in radians Point being that fortran is not hopelessly opaque. A subroutine…
Here's the declaration of the parameters:
INTEGER N, INCFD, NE, IERR
REAL X(*), F(INCFD,*), D(INCFD,*), XE(*), FE(*)
LOGICAL SKIP
Sorry, but no comments to be found :)> NE,XE, and FE "E" means "error"? Maybe.
Wrong guess - "E" means "Evaluation" as in "to be evaluated" in this case. It's also not clear which are inputs and outputs and primitive data types give no indication at all about constraints and use-case.
> IERR is an error flag. Idiomatic fortran there.
Now that's true, but idiomatic cases that are well documented and don't benefit from AI documentation. Simple pattern matching will do.
The point I was trying to make wasn't really about any specific programming language either. The point is rather that documentation requires translating implementation to intent and purpose.
If you have a system that's capable of translating a program into purpose, constraints, and usage example(s) expressed in plain natural language; you have created a system to end all programming languages, because the inverse transform would be possible as well...
Re: Deep learning to translate between programming languages
#35Re: Deep learning to translate between programming languages
#36Earlier quoted context omitted.
Guessing !! N,X, and F are probably related to NE,XE, and FE "E" means "error"? Maybe. IERR is an error flag. Idiomatic fortran there. Each of those variables will be defined later on, in the code. at least with a type (not required, but it is not 1960 anymore). In that declaration is where some comments would be. REAL*8 N ! Radius of the body in radians Point being that fortran is not hopelessly opaque. A subroutine…
> In that declaration is where some comments would be. Here's the declaration of the parameters: INTEGER N, INCFD, NE, IERR REAL X(*), F(INCFD,*), D(INCFD,*), XE(*), FE(*) LOGICAL SKIP Sorry, but no comments to be found :) > NE,XE, and FE "E" means "error"? Maybe. Wrong guess - "E" means "Evaluation" as in "to be evaluated" in this case. It's also not clear which are inputs and outputs and primitive data types give n…
nice to see someone else using fortran 77. or at least reading it.
Re: Deep learning to translate between programming languages
#37I see the potential to speed up code a lot. Say that you could translate Python to C++ or Nim that would speed up the program a lot. You could profile and translate select hot often used code paths. This has the potential too save a lot of energy by using more efficient programs.
Re: Deep learning to translate between programming languages
#38I see the potential to speed up code a lot. Say that you could translate Python to C++ or Nim that would speed up the program a lot. You could profile and translate select hot often used code paths. This has the potential too save a lot of energy by using more efficient programs.
That seems like a lot of effort when Julia is both high-level and efficient already.
Re: Deep learning to translate between programming languages
#39I see the potential to speed up code a lot. Say that you could translate Python to C++ or Nim that would speed up the program a lot. You could profile and translate select hot often used code paths. This has the potential too save a lot of energy by using more efficient programs.
This ML crap is inexplicable, and nearly guaranteed to introduce subtle bugs and performance regressions.
Re: Deep learning to translate between programming languages
#40To imagine future compilers may just one day be AI powered is mind boggling to me.
I've heard that LLVM uses neural networks to drive the register allocator. I don't know how well it works, but it's a pretty cool idea.
At compile-time only, people have also been using trained models to derive cost functions for sequences of instructions (as opposed to analytical models which become very difficult to derive these days given the complexity of modern CPU architectures)