4 ms·
sound great, doesn't work. if it would work, we would have perfect translations for spoken languages already. and google(translate) with it's massive computing,
by fsajkdnjk 7y ago
sound great, doesn't work. if it would work, we would have perfect translations for spoken languages already. and google(translate) with it's massive computing, financial and brain power still hasn't figured it out.
- hooplaz 7y agoProgramming languages and natural spoken languages are very different.
- The_rationalist 7y agoBTW any programming language construct can be expressed in natural language. (maybe unidiomatically) The reverse isn't true. Maybe one day the field of literate programming will come to maturity.
- cdirkx 7y agoSpoken languages have the problem of ambiguity, context, changing meaning over time to different people. Programming languages are pretty structured and well defined.
- krcz 7y agoOn the other hand most spoken languages use similar underlying concepts (with some exceptions, e.g. translation to language without subjective direction terms like "left" or "right" might be tricky). Programming languages can have completely different execution models, especially when you compare ones between paradigms. Translating imperative for loop into map/filter/fold chain in functional language would have to be very non-local.
- cdirkx 7y agoYes it would probably produce a lot of unidiomatic code (see for example c2rust [1], which generates semantically equivalent Rust code, but with raw pointers and unsafe everywhere). In the worst case you could even just emulate the origin language in the target language, everything is turing complete after all. With enough effort and smart transformation passes however, I think you could come pretty close to something resembling "native" code. It might not always be worth it to spend that development time though. [1] https://c2rust.com/ https://c2rust.com/
- forgotmypw77 7y agoFirst we,ll figure out translating Java to Ruby, then English to Japanese, and only then we,ll be ready to translate Perl :D
- JadeNB 7y agoCompilers obviously don't work, because, if they did, then we could automatically turn written English into machine language.
- samatman 7y agoOn the contrary, it's trivially possible due to Turing Completeness. Programming languages aren't languages. They're arithmetic calculations wearing linguistic clothing. Making it idiomatic and fast, is very, very difficult. Achievable for a subset focused on querying MongoDB? Absolutely.