4 ms·
It is a fun exercise to take a non-english language, look at its idiosyncrasies, and design a programming language with that. My native language is German. Som
by qznc 7y ago
It is a fun exercise to take a non-english language, look at its idiosyncrasies, and design a programming language with that.
My native language is German. Some ideas:
* We can take nouns and combine them to longer nouns. A "list of objects" is "Objektliste". Parsing will be a challenge but it makes the language more terse and auto-completion is faster.
* We also have gender specific articles. It is "das Objekt" and "die Liste". We could use this to have three possible namespaces, so "der Foo", "die Foo", and "das Foo" would refer to three different things.
* All nouns start with an uppercase letter, so your loop index must be "I" or "J". We could have user-defined qualifiers (like const) which are distinct from variables because they start lowercase. So where you have to use @ in Python, we just use lowercase.
- asveikau 7y ago> We could use this to have three possible namespaces, so "der Foo", "die Foo", and "das Foo" would refer to three different things. You're reminding me of perl, where $foo, %foo, and @foo can coexist.
- nneonneo 7y agoOddly, all three examples have analogues in real programming languages already: - in many C-derived languages, a “list of objects” is spelt “object[]” as a type, with the “list” (array) specifier postfixed. (Functions declared to return arrays take this syntax to quite an interesting extreme.) - in Perl and some derivative languages, sigils serve as a prefix to denote context of use or type; $var is different than %var or @var, for example. - In Ruby, a leading uppercase character defines a constant, and some aspects of the language are sensitive to the case of the identifiers used. Of course, it’d be super interesting to put many of these ideas into a single language, as it could well be quite different (and refreshing!) than many of the languages we use today.
- c3534l 7y ago> All nouns start with an uppercase letter, so your loop index must be "I" or "J". We could have user-defined qualifiers (like const) which are distinct from variables because they start lowercase. So where you have to use @ in Python, we just use lowercase. Yeah, but i and j come from math. I've never seen a math paper where people summed a variable using a capital subscript. I think it might be more interesting to think about how you write a German version of a language that is meant to be English-like. Something like SQL or Cobol.
- masswerk 7y agoAlso, a loop index is a placeholder for a numeral, like "eins", "zwei", "drei", hence Für i = 1 bis 2 ... However, using articles, Für das I = 1 bis 2 ... And we may want to use a "Doppelpunkt" and an exclamation mark, since this is still a command: Für i: 1 bis 2!
- masswerk 7y agoExtending on the importance of commands in the German language (and culture) – these are a serious matter and not to be fuzzed with –, a computer featuring an explicit fast-mode, like the Sinclair ZX81, may lend itself particlarly well to a German language implementation: Für i: 1 bis 10, aber schnell! ;-)