Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Retrofitting an existing language with flexible syntax (in this case, LISP) to non-English languages is relatively easy. They are not necessarily bad and can be useful for learners and casual users, but deviating from ASCII alone doesn't remove a cultural bias as the OP states. Programming languages have to be developed from scratch to fit to other spoken languages and cultures in my opinion. I'm aware of multiple (non-esoteric [1]) languages in this direction, none satisfactory enough though.

[1] If we allow esolangs I would proudly present Aheui (https://esolangs.org/wiki/Aheui) as a good example.



Now that I think about it, languages that aren't subject-verb-object probably find OOP insane.

I tried to find an example of this and found a somewhat related article about how Japanese grammar maps nicely onto ruby: https://thoughtbot.com/blog/learning-japanese-the-rubyist-wa...


> Now that I think about it, languages that aren't subject-verb-object probably find OOP insane.

I'm not sure if that's true in this generality. After all, "agent.doSomeThingWith(object)" is not a declarative sentence, it's a command. So you'd have to look for languages where imperatives don't have subject-verb-object (as an acceptable) order.

I'm sure there exist some, but at least I would expect them to start with the agent you are commanding.


The agent still needs to hear the complete command to carry it out, so there's no strong pressure to prefer a particular word order.

In German, the difference between the imperative "Machen Sie das!" [Do that, you (polite form of address).] and the declarative "Sie machen das." [You (polite form of address) are doing that.] is that the imperative does not put the agent first.


Interesting point about German, though du/Sie isn't the kind of "agent" I was thinking of. I meant something where you name the agent by name, like "Frau Huber, machen Sie das!". And yes, I know you can put the name at the end as well.

The du/Sie in such sentences is something that's specific to German compared to the other languages I know, which don't need (or even allow) the pronoun: "do this", "faites ça", "gjør det" are all complete sentences. In fact even in German it's specific to Sie, for while you can say "mach Du das", "mach das" is fine as well. (If you speak a different dialect from mine, you might insist on "mache" instead of "mach", but around here that ship has sailed.)


Interesting how German doesn't allow to drop the addressing pronoun due to how the sentence structure works, but Scandinavian readily allows even the number of addressees to be derived from the context. I guess I prefer English over German as the language for programming because it shoehorns a lot of structure on a later, more boiled-down incarnation of Germanic, and notably (therefore?) ships many short and flashy words, such as "if", "on", "not", "do".


there is chinese python.

http://reganmian.net/blog/2008/11/21/chinese-python-translat...

I bet there are IoT devices out there that use it already.

For example:

#!/usr/bin/env zhpy

# 檔名: while.py

數字 = 23

運行 = 真

當 運行:

    猜測 = 整數(輸入('輸入一個數字: '))


    如果 猜測 == 數字:

        印出 '恭喜, 你猜對了.'

        運行 = 假 # 這會讓循環語句結束

    假使 猜測 < 數字:

        印出 '錯了, 數字再大一點.'

    否則:

        印出 '錯了, 數字再小一點.'
否則:

    印出 '循環語句結束'
印出 '結束'

which translates to:

  #!/usr/bin/env python
  # File name: while.twpy
  number = 23
  running = True
  while running:
    guess = int(raw_input('Enter an integer : '))

    if guess == number:
        print 'Congratulations, you guessed it.'
        running = False # this causes the while loop to stop
    elif guess < number:
        print 'No, it is higher than that.'
    else:
        print 'No, it is lower than that.'
  else:
    print 'The while loop is over'
  print 'Done'


> Programming languages have to be developed from scratch to fit to other spoken languages and cultures in my opinion.

This is really interesting. I wonder if there are some human language with properties that would allow for programming language constructs that we don't really use today.

My linguistic skills are not good enough to really suggest an example, but considering there is a language[0] (almost) without relative directions (left and right), which is mind blowing to me, it feels like there should be something interesting out there.

[0]: https://en.wikipedia.org/wiki/Guugu_Yimithirr_language


As a very superficial example, Korean is agglutinative and you can't easily take affixes apart from a word. For example, you can't easily recognize that the following sentence has a noun "언어" and a verb stem "배우-" without a substantial knowledge about Korean:

    언어를 배운다.
    [topic omitted] Language-(object marker "를") learn-(verb conjugation "ㄴ다").
    (One) learns a language.
Many syntaxes are based on easily segmented tokens, or words, so they are not a good fit for Korean and other agglutinative languages. My friend has made a programming language, Yaksok [1], specially made for Korean and solving this problem by making all invocations as a pattern, somewhat similarly to AppleScript:

    # - "약속" is a keyword for procedure declarations.
    # - Unquoted words are formal parameters.
    # - Anything quoted should occur literally, except for slashed alternations
    #   used for affixes varying by the preceding word.
    약속 대상"을/를 배운다"
        ...
Of course this results in a very unconventional parser.

[1] http://yaksok.org/


> This is really interesting. I wonder if there are some human language with properties that would allow for programming language constructs that we don't really use today.

Ooh, just thought of something interesting: I lived in Turkey for 4 months, and in Turkish, rather than using location to indicate which words modify each other, you use suffixes. (At least, as much as I could figure out in that time.) Then you can order your words for clarity and emphasis, rather than for meaning.

You could imagine doing the same thing with functions or expressions; rather than being stuck with "infix" operators, which need precedence and parentheses, or "prefix" operators forcing you to use RPN, you could order them the way you want.

So perhaps the following three expressions could all evaluate to the same thing ("a / b" in most C-based languages):

    /' a' b"
    /' b" a'
    b" /' a'
    a' /' b"
    a' b" /'
The idea would be that `/` is the verb, and `'` is the suffix indicating that its two "arguments" are `'` and `"`.

That sounds like an interesting concept to explore anyway.


There are a lot of languages like this - this is the much-studied spectrum of analytic vs. synthetic.

English is one of the most strongly analytic languages (Chinese being even more extreme) - it determines word relationships and function with word order and helper words.

Whereas Standard Arabic, Ancient Latin, and Finnish are very synthetic, changing words to indicate their function and relationship to other words in the sentence. If your language has the concept of "declensions", it's probably on the synthetic end of the spectrum.

Interestingly, after observing an increase in analyticity over time in European languages, some linguists have hypothesized that analytic languages are easier for foreign speakers to learn as adults, and that this causes languages with lots of geographic spread and inter-language contact to become more and more analytic. With creole languages being of course the most striking example.


> some linguists have hypothesized that analytic languages are easier for foreign speakers to learn as adults, and that this causes languages with lots of geographic spread and inter-language contact to become more and more analytic.

That's an interesting theory, and certainly fits with Mandarin (aka "Common Speech"); but how well does it fit with the prevalence of Greek in the ancient world, Latin during the Middle Ages, and Arabic in the Middle East and North Africa now? Those are all towards the "synthetic" scale, aren't they? Did/have those languages drift/ed to become more "analytic"?


Yeah, Latin and Greek became somewhat more analytic during the time periods where a lot of foreign speakers were adopting them as their main languages. (That was during the Roman period, not the Middle Ages, for Latin; Latin in the Middle Ages was a dead language used only by learned people in non-everyday contexts, so its grammar was mostly preserved.) I don't know about Arabic.


Standard Arabic is similar to Latin in Medieval Europe - it is a second language that is used for formal education and communication, but that no one speaks as a native language. All the Arabic languages that people speak as first languages are much more analytic.

It's a similar phenomenon to Latin, where the formal written Latin used in Europe preserved things like case endings and flexible word order, while the Vulgates that later became the Romance Languages dropped a lot of that and started relying much more heavily on word order.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: