3 ms·
How about a macro system that replaces keywords in any natural language for any programming language? This would be only an i8n layer that doesn't mess with any
by vehemenz 6y ago
How about a macro system that replaces keywords in any natural language for any programming language? This would be only an i8n layer that doesn't mess with any core functionality of the programming language.
As long as you don't support COBOL, it should be pretty straightforward.
Edit: Maybe not so straightforward!
- klyrs 6y agoA consequence of this is that you can't use keywords from any language for your symbol names. Or, I guess, you could do like Perl and defined symbols need a $ prefix or somesuch
- Jtsummers 6y agoThis would be easier with languages where keywords are in clear and consistent syntactic positions and identifiers can match keywords (that is, the keywords are only "kind of" special, more by position than value). Otherwise, you'll run into issues when someone is using Language X but has identifiers that happen to coincide with Language Y's keywords. You wouldn't want to error out here, and you don't want Language X writers to be forced to be aware of the many hundreds of extra keywords that are now required knowledge to avoid collisions and permit universal translation. For instance, in a programming language which uses `and` as a keyword in English for the logical operation, this would be translated into Spanish as `y`. Well, in graphical applications `y` is a perfectly natural variable name for the English speaker (and probably the Spanish speaker, but their dialect of the language wouldn't permit it). Now the English program can't be translated properly into Spanish unless the syntax is such that variables and keywords are always unambiguous so that this can be legal in the Spanish version: y < 0 y x > 10 y < 0 and x > 10 Of course, switching to a language which prefers symbols over keywords would help to minimize this issue (as in C where `and` is not a keyword, in contrast with Ada where `and` is a keyword).