TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Japanese explained to programmers

346 pointsby iraldirover 2 years ago

30 comments

teddyhover 2 years ago
“<i>The bottom line is that Politeness Levels are completely beyond your understanding, so don&#x27;t even try. Just resign yourself to talking like a little girl for the rest of your life and hope to God that no one beats you up.</i>”<p>— So You Want To Learn Japanese <a href="http:&#x2F;&#x2F;www.stmoroky.com&#x2F;links&#x2F;sywtlj.htm" rel="nofollow">http:&#x2F;&#x2F;www.stmoroky.com&#x2F;links&#x2F;sywtlj.htm</a>
评论 #34597025 未加载
ickooniteover 2 years ago
I have to fundamentally disagree with the premise: Japanese is probably one of the least logical languages on the planet. To wit, it combines the written complexity of Chinese with the spelling inconsistency of English.<p>The one-to-many relationship between a given kanji and its many pronunciations makes it maddeningly difficult, even for native speakers. 生, for example, has at least <i>nine</i> pronunciations. The only way a programmer might “solve” Japanese would be with copious use of lookup tables or prefix trees.
评论 #34603973 未加载
评论 #34595129 未加载
评论 #34595719 未加载
评论 #34594961 未加载
评论 #34595069 未加载
评论 #34595764 未加载
评论 #34595174 未加载
评论 #34604241 未加载
评论 #34597972 未加载
评论 #34595052 未加载
评论 #34595566 未加载
评论 #34595483 未加载
philsnowover 2 years ago
The author has discovered (linguistic) morphology. The `setRole` function he describes compiles to various morphemes in Japanese like は, を, etc. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Morphology_(linguistics)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Morphology_(linguistics)</a><p>We have this in English too except remarkably little of it actually comes out. Pluralization and possession being marked with -(e)s and -&#x27;s suffixes, and &quot;subject-verb agreement&quot; (one wouldn&#x27;t say &quot;the birds eat<i>s</i> the food&quot; but rather &quot;the birds eat the food&quot;) are examples of morphology in action in English.<p>Several folks think that the capacity for language in general is common to all humans, and that we have some proto-language hidden away deep in our brains, inaccessible, where our conception of the world bubbles up through layers of our brain&#x2F;consciousness, until thoughts-as-words eventually fall out of our mouths or onto paper, and then the reverse process happens as well.<p>(Incidentally I think the particle は marks the &quot;topic&quot; of the sentence, not the subject. The subject of the verb is marked with が, and Japanese speakers elide&#x2F;omit a lot of parts of sentences, so there&#x27;s tons of sentences where there is no explicit subject but there is a topic. <i>Please correct me here,</i> this is all from faint memory.)
评论 #34597553 未加载
评论 #34622188 未加载
greyboxover 2 years ago
I can see where the author is comming from . . . although its a bit of romanticism.<p>Japanese is extremely regular, which makes the grammar easier to learn though it is completely different to any language with indo-european roots.<p>For valuable insights into Japanese grammar I recommend &#x27;Making Sense of Japanese&#x27; by Jay Ruben (he translated works of Murukami including Norwegian Wood into English).<p>Also a youtube channel Cure Dolly <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;@organicjapanesewithcuredol49">https:&#x2F;&#x2F;www.youtube.com&#x2F;@organicjapanesewithcuredol49</a> Who sadly died a few years ago, but who&#x27;s insights nonetheless are very helpful (if you can get past the modified voice audio)<p>It was a coincidence that I had just finished some reviews on wanikani just before reading this. I find it very helpful along with using the Core 2k&#x2F;6k Anki deck for learning Vocabulary.
louhikeover 2 years ago
Just a nitpick but the particle “ha”&#x2F;“は” is not really used to set the subject but the topic or context. The topic or context can often be the subject but it’s an important subtlety. The particle to set the subject is “ga”&#x2F;“が”.
评论 #34594853 未加载
评论 #34594912 未加载
999900000999over 2 years ago
By far the hardest language I&#x27;ve ever tried to learn. In addition to pissing my Korean girlfriend off, it was so difficult I dropped the class after 2 weeks or so.<p>Chinese is much much easier by an order of magnitude. Particularly if your focusing on speech and grammar vs writing. Not that Japanese writing is any easier.<p>Hindsight is 20&#x2F;20. Shoulda took Spanish...
评论 #34603929 未加载
评论 #34595533 未加载
评论 #34596513 未加载
Tor3over 2 years ago
As for explaining Japanese to programmers.. When I try to explain basic Japanese grammar to people in general, they <i>always</i> respond &quot;Sounds complicated&quot;. But if I explain basic Japanese grammar to long-time programmers they simply reply &quot;Sounds logical.&quot;<p>(Edit: Added &#x27;basic&#x27; - I don&#x27;t go around trying to explain Japanese grammar in full..)
katsuraover 2 years ago
What&#x27;s most interesting to me about Japanese is that if you look at the Wikipedia page for most spoken languages [0], all of the top 15 show more than 10 million people who speak the language as a second language, except Japanese, there only 0.1 million (100k) is shown.<p>This means that either there is no good way to track this, or barely anybody gets to a level in Japanese where they would end up in the statistics.<p>[0] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_languages_by_total_number_of_speakers" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_languages_by_total_num...</a>
Cruncharooover 2 years ago
&quot;Being born in France, I was immersed in Japanese culture from a very young age.&quot;<p>I fail to see how these two things are connected?
评论 #34594882 未加载
评论 #34594849 未加载
评论 #34595056 未加载
评论 #34595112 未加载
评论 #34594854 未加载
crosserover 2 years ago
That was fascinating reading, thank you!<p>I take an issue though with this assertion:<p>&gt; The order [...] is quite different to english but very similar to functional programming.<p>The most widely accepted (imo) order of function composition is right to left:<p><pre><code> send(makeUrl(&quot;http:&#x2F;&#x2F;...&quot;)) </code></pre> just like in English &quot;blue fish&quot;: transformation stands to the left to the object that is being transformed (*). Whereas &quot;transformation follows the object&quot; is an OO tradition, as shown in your examples. &quot;Take object, apply transformation (method) yielding another object, apply transformation to that new object, etc.&quot;<p>(*) In quintessentially functional Haskell, you <i>can</i> compose functions both ways, but right-to-left is more traditional:<p><pre><code> {- - Find numeric value of the first figure of the decimal representation - of a number: - 1. convert it to a string of decimal characters (show) - 2. take the first character of the string (head) - 3. convert the character to a string containing one charcter (:[]) - 4. convert the string of one decimal character into an integer (read :: Int) -} main = do let firstfigure1 :: Int firstfigure1 = read . (:[]) . head . show $ 413 print firstfigure1 {- - Reverse the order of composition. Define &quot;right-pointing&quot; versions for - (.) and ($) -} let (.&gt;) = flip (.) -- it will become infixl 9 by default ($&gt;) = flip ($) infixr 0 $&gt; -- We need value lower than the above. Use the same as $ firstfigure2 :: Int firstfigure2 = 413 $&gt; show .&gt; head .&gt; (:[]) .&gt; read :: Int print firstfigure2</code></pre>
w-mover 2 years ago
As it&#x27;s an article about language, I hope you don&#x27;t mind me pointing out that there&#x27;s an additional h in<p>&gt; an introduction to how different language can be <i>has</i> different as<p>It&#x27;s probably just a simple typo here. But in my head it immediately sounds like a French speaker overcompensating, by adding H&#x27;s where there aren&#x27;t any [0], as I have heard this so many times. As a French speaker learning English as a second language, one would learn that H&#x27;s at word beginnings need to be pronounced in English. And then the brain sneaks them in with English words that didn&#x27;t have any to begin with, like hangry, or habout. I find the whole topic of overcompensation super fascinating [1]. Another good one is German ESL speakers subconsciously overcompenthating by changing s into th.<p>[0]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;H-dropping#H-insertion" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;H-dropping#H-insertion</a><p>[1]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hypercorrection" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hypercorrection</a>
评论 #34595371 未加载
评论 #34596963 未加载
评论 #34595162 未加载
antiterraover 2 years ago
I recognize that one can’t expect English speakers to consistently pluralize foreign words in ways that match the origin language, and that it is not objectively incorrect when people just add an s.<p>However, in my opinion, an article purporting to inform about Japanese in a programmatic way really should avoid using “hiraganas,” “kanjis” and “katakanas” as pluralization of thise terms.
评论 #34606747 未加载
评论 #34604302 未加载
vvilliamperezover 2 years ago
<p><pre><code> request.setURL(&quot;serverurl&quot;).send() </code></pre> This style of sentence structure was one of the strangest things to get comfortable with. You have to think a bit differently.<p>The function chaining makes sense here and I wonder if the language had influence on Ruby&#x27;s development.<p>Anyone interested in the language should definitely check out the Genki series. It&#x27;s written well enough you could fully teach yourself.<p><a href="https:&#x2F;&#x2F;genki3.japantimes.co.jp&#x2F;en&#x2F;intro&#x2F;" rel="nofollow">https:&#x2F;&#x2F;genki3.japantimes.co.jp&#x2F;en&#x2F;intro&#x2F;</a> or amazon.
评论 #34594965 未加载
评论 #34595204 未加载
评论 #34595277 未加载
traceroute66over 2 years ago
Honestly its really tiring to see people promoting the rote-learning of Kanji.<p>Not only do most Kanji rote-learning resources not take into account aspects such as compound words, but also its just the wrong way to learn Japanese full stop.<p>No language learning works well if you are continuously translating it back into your native tongue. You need to learn to think in the language you are learning, that is the only way you are going to gain any sort of fluency. Just knowing that <i>X</i> translates to <i>Y</i> is not going to help you, even if you memorise the whole dictionary.<p>You <i>might</i> get away with translating back into your native tongue with a Western language, but you won&#x27;t with Japanese.<p>With Japanese there&#x27;s no escaping learning the grammar and other aspects. It&#x27;s just your choice if your want to do it the hard way (textbook theory) or the <i>harder</i> way (immersion via graded readers, conversations with patient natives, or anything else similar).<p>All the time and effort people put into rote-learning Japanese Kanji should really be expended learning Japanese in a more holistic way.<p>Otherwise you might as well just buy one of those books with set-phrases such as &quot;where&#x27;s the toilet&quot;.
评论 #34594855 未加载
评论 #34595119 未加载
评论 #34594741 未加载
评论 #34594729 未加载
评论 #34596327 未加载
评论 #34594703 未加载
评论 #34594773 未加载
评论 #34595143 未加载
评论 #34595480 未加载
评论 #34594735 未加载
评论 #34594747 未加载
hsn915over 2 years ago
Honestly this feels like &quot;programmer circle jerk&quot; material.<p>I love Japanese. I love it so much that I (accidentally?) moved to Japan.<p>But it really has nothing to do with programming. It&#x27;s a natural langauge with all the idiosyncrasies of natural languages. In fact I&#x27;d say that English in comparison feels like a man-made language purpose built for math and technology.
评论 #34597655 未加载
评论 #34595474 未加载
评论 #34595311 未加载
评论 #34596320 未加载
评论 #34595133 未加载
评论 #34595291 未加载
评论 #34597073 未加载
评论 #34595298 未加载
评论 #34598788 未加载
评论 #34596639 未加载
评论 #34600666 未加载
PurpleRamenover 2 years ago
TIL Japanese kanjis are like German words, composed to make a new meaning. Quite insightful. Is this also the case for chinese usage of Kanji? I vaguely remember that Japanese language differs from Chinese language because of using sybils or something?
评论 #34595170 未加载
评论 #34595564 未加载
评论 #34595249 未加载
评论 #34596032 未加载
mrweaselover 2 years ago
Maybe a little off-topic, but do you in general need to account for larger fonts when designing software to work with kanji og traditional Chinese? It could just be my untrained eyes, but I find it hard to see the details in many of the glyphs.
评论 #34595824 未加载
评论 #34595193 未加载
hikkijpover 2 years ago
It&#x27;s no different from english or probably most other languages if you think every character is a primitive. Example: word.new(&quot;T&quot;, &quot;E&quot;, &quot;A&quot;) would be equivalent to word.new(&quot;牛&quot;). Then word.new(word.new(&quot;T&quot;, &quot;E&quot;, &quot;A&quot;), word.new(&quot;S&quot;, &quot;P&quot;, &quot;O&quot;, &quot;O&quot;, &quot;N&quot;)) would be equivalent to word.new(word.new(&quot;牛&quot;), word.new(&quot;肉&quot;)).<p>Next concept the author mixed is working with the verbs, verb.new(word.new(&quot;E&quot;, &quot;A&quot;, &quot;T&quot;)).PastTense() would give you &quot;ate&quot; Just like verb.new(word.new(&quot;食&quot;, &quot;べ&quot;, &quot;る&quot;)).Polite().Past() would output &quot;食べました&quot;<p>Then working with sentences, ex: Topic.new(&quot;me&quot;).toString() would be just &quot;meは&quot;... Put it all together and output everything subject &gt; object &gt; verb, instead of the more familiar subject &gt; verb &gt; object.<p>The author mixed a lot of those grammar concepts, with the words etymology... and it got confusing.<p>&quot;2 kanjis becoming 1&quot; is just the radical. 涙 (tear) 汗 (sweat) 泳ぐ (swim) 沈む (sink) 溺れる (drown), they all share the same radical (氵&#x2F;sanzui&#x2F;mizu&#x2F;water). While it&#x27;s not a rule, they are likely to have some relation to it. Just like in english waterfall, waterproof, waterspout, watermelon, etc.<p>I like the fact that the author is fascinated by the Japanese language and wants to share his discoveries. I guess everybody learning a seemingly completely new (unrelated to anything you know), experiences a similar phase. In his case he found similarities with a programming language. And I guess we all do that, we connect the things we&#x27;re learning to the things we already know.<p>Someone learning english would probably be equally amazed by the watermelon. I mean... It&#x27;s not so surprising if watermelon in your native language is, let&#x27;s say: Melancia (portuguese). It takes half of the discovery surprise from you, as you already could suppose it&#x27;s melon related.<p>I can&#x27;t deny, &quot;Fire + Mountain = Vulcan&quot; was awesome to me as well. Learning that &quot;Vulcan = god of fire in ancient roman mythology&quot; does not hit me the same way, I already expect it to be greek&#x2F;roman&#x2F;latin.
评论 #34598051 未加载
0xmarcinover 2 years ago
For some reason Japanese culture is quite popular among nerdy types (be it anime? games? sushi?). I was also fascinated by Japan, even tried to learn the language but got discouraged early on by having to learn 3 different &quot;writing systems&quot;. The grammar was also not quite easy to grok (definitely not easy as the presented code-like example).<p>Now I am more fascinated by contemporary China than contemporary Japan. I see that Japanese culture is based on much more ancient and broad Chinese culture. I also see a pick up in interests to learn Mandarin among my friends&#x2F;coworkers.<p>I watched a few Chinese movies and I have to say they bring a breath of fresh air. I think whenever we want it or not we will see more Chinese media in the future, simply because they are different from what a typical person is used too. That makes them more interesting at least in the beginning.
评论 #34601454 未加载
aeonikover 2 years ago
In case anyone is curious, I asked ChatGPT how Japanese refer to &quot;fish that are blue&quot; since &quot;blue fish&quot; is also the word for mackerel.<p>Coincidentally, it&#x27;s exactly how I just distinguished them in English just now.<p>You can read ChatGPT&#x27;s replies below (I manually collated the replies, leaving my prompts out):<p><i>In Japanese, mackerel is written as 鯖 (さば). </i><p><i>Blue fish&quot; in Japanese is 青い魚 (あおいう お).</i><p><i>The middle character in &quot;青い魚 (あおいうお)&quot; is い, which is a form of the auxiliary verb &quot;to be&quot;. In this case, it indicates that the noun &quot;fish&quot; (魚) is in a state of being &quot;blue&quot; (青い).</i><p><i>By using the auxiliary verb &quot;to be&quot;, the phrase &quot;blue fish&quot; (青い魚) can refer to any fish that is blue, as opposed to a specific type of fish like mackerel (鯖). This helps to avoid confusion and allows for a clear distinction between different types of fish.</i>
评论 #34595309 未加载
raverbashingover 2 years ago
&gt; The japanese standard library offers a bunch of chainable functions to add meaning to your primitive types.<p>English and French work <i>in the same way</i>.<p>However roles are usually determined by word order. But in essence it&#x27;s the same thing as obj.do_stuff(), &#x27;obj&#x27; is the thing that do_stuff.
评论 #34595051 未加载
lauriegover 2 years ago
Here&#x27;s my take on explaining Japanese as a programming language.<p>Verbs are functions. In English, arguments are positional.<p>SUBJECT verb OBJECT.<p>I eat pizza.<p>But in Japanese they are named arguments with small helper words called particles. The subject uses &#x27;wa&#x27; and the object used &#x27;wo&#x27;. The convention is postfix in contrast to English&#x27;s prefix notation.<p>Watashi-wa pizza-wo taberu.<p>With other verbs English uses named arguments too:<p>I go <i>to</i> the bank <i>by</i> car.<p>Japanese uses &quot;e&quot; and &quot;de&quot; for the arguments to this verb. Car is kuruma so &quot;by car&quot; becomes &quot;kuruma-de&quot;.<p>Watashi-wa kuruma-de ginko-e iku<p>Obviously this is a massive simplification but I always found thinking about verbs as functions and the other words as named arguments to be very easy to understand.<p>(Edited for clarity)
评论 #34597271 未加载
macspoofingover 2 years ago
Very interesting. How does regex&#x2F;pattern matching work with Kanji? Or does it?
评论 #34595976 未加载
评论 #34595958 未加载
abecedariusover 2 years ago
Surprised this post didn&#x27;t mention Forth. <a href="https:&#x2F;&#x2F;arcanesentiment.blogspot.com&#x2F;2011&#x2F;02&#x2F;japanese-lisp-forth-and-historical.html" rel="nofollow">https:&#x2F;&#x2F;arcanesentiment.blogspot.com&#x2F;2011&#x2F;02&#x2F;japanese-lisp-f...</a><p>BTW this toy language came up in my search for the above: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;typeswitch-dev&#x2F;ac86d7e32167c1e5bf311c796cedc1a8" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;typeswitch-dev&#x2F;ac86d7e32167c1e5bf311...</a>
评论 #34602116 未加载
samwestdevover 2 years ago
Should have used Ruby :p
javier_e06over 2 years ago
I once heard that Rails the aggregate object for Person is People. I went like, wow. In Spanish you say: &quot;Baraja la baraja&quot; .. shuffle the deck. Which makes sense (the object changes itself but the verb is the same as the noun&quot; Is like Buffalo buffalo buffalo Buffalo buffalo.
评论 #34601531 未加载
DennisPover 2 years ago
Back in the early 2000s I saw a wonderful 3-part series explaining Japanese as a context-free grammar. It was on kuro5hin, which later shut down and everything disappeared. At one point I was able to find two of those posts archived, but never the whole thing.<p>For a moment the title got my hopes up.
praveen9920over 2 years ago
I wonder if there is any &quot;natural&quot; language which has the precision of programming language, Perhaps there are efforts to create one?<p>I believe a language like that could be truly globalised without any cultural aspects
rideontimeover 2 years ago
The AI-generated origins of the shrine image at the foot of the article are extremely obvious, btw.
评论 #34596306 未加载
janniksover 2 years ago
Great stuff!! If there were a whole course in this style, I would pay good money for it!