Chinese programming language: #lang ming

Hi everyone,

For the last year, I've been trying to explore what could it achieve if I made Chinese as the interface of Racket. I'd like to share with you what I've found in this post.

My story started from my noticing the lack of expression of English when it is imposed to naming things in programming languages, especially a language like Lisp, which indulges using only parenthesis instead of developing different forms like other modern programming languages to distinguish different things. as a result, different means of conceptions and functions depend only on their names. however, most of those names don't elaborate on the usages and purposes. I guess that's also part of the reason why we developed type systems and lots of dazzling syntaxes within all the modern programming languages.

And next, I'll skip the blah blah and get into the most important thing that I what to say here.

  1. Chinese can make names really short with reserving more information. That's easy to understand, have a look at them, chinese characters are much more diverse, take English as an example, the writing system of which actually originates from recording the pronunciation of words.

For the information, when I say Chinese I do not mean modern Chinese, it can't make names short. To make names short, we need to create new chars for new concepts, which creating method is an inherent feature of Chinese and it is called liushu(六书), which is also the reason why Chinese have more than 100,000 chars in the history of its using, because the ancient Chinese people keep creating new chars to express new concept they had met, although lots of those created chars were abandoned to use and nobody knows the meaning and reason why they were created. And at last, there're only 3500 frequently used chars for modern Chinese.

  1. Not all but most Chinese chars are constituted by meaningful components, different chars share different components and thus those chars can be grouped by different components to imply which grouped chars have this trait and which have that trait. Migrating this feature to programming languages, it can be used to structure new chars as names for those concepts which all hold a special usage, purpose, or input output types of parameters and so on.

This is not that hard to understand, take current Racket as an example, the ! and ?, once you see ! in the function names, you'll know this function would directly change the value of the original variable, ? stands the output result must be a boolean. the components of Chinese chars work the same way:

江(river)、河(also river)、湖(lake)、海(sea)、泪(tear, 目 means eyes)、沉(sink)、泣(cry)、浅(shallow), notice that all those cn chars share the same component 氵, which is the simple way to write 水(water), to express all those concepts have the same thing to do with water actually.

Following this thought, I created lots of Chinese chars for Racket concepts, such as pairs, lists, hash, vectors, and related functions as well. I choose Racket because the concepts of Lisp are highly connective, by using Chinse this connection can be expressed out rather explicitly. For examples:

  1. all the concepts and functions related to numbers of Chinese chars consist of the component "米"; e.g.;
  2. 亻is used to express that for a function, the output result has the same type as the input. In contrast, 阝is almost the same as 亻, except the content of the output result must be a part of the input. e.g..

for more rules I made, please check out http://www.yanying.wang/ming/. And I'll be very glad to hear the feedbacks or anything you think of my post.

7 Likes

Thank you for doing this :racket_heart:

I love that you made an internal lang to do the mappings
#lang at-exp s-exp "../../private/mapping-lang.rkt"

best regards

Stephen

@spdegabrielle thanks for the comment and knowing that you notice and love the mapping files. For the past year, I've put lots of my energy into the mapping, which is the core spirit of ming-lang, and the reason I call it 'ming-lang' is because the 'ming' in Chinese means naming something, giving somebody or something a name.

Since about three weeks have already past, I've only got one comment, so I'd like to elaborate on it a bit more to see if this can provoke more discussion.

Actually, I'm imagining a programming language world formed with Chinese characters as the interface, and which interface can be easily understood by all the people around the world irrespective he knows Chinese characters or not. Because eventually, those characters would be far more different than cn chars, they are only created by using the way how cn chars are created.

let me take an example below:

the preceding picture was cited from 5.2 双和􏿴 , notice the = sign, what following it is the mapping names from racket, and also notice the names of ming, all of them share the component , which means search , and each constitutes with different components to form a much more specific meaning:

  1. stands for knife, which means delete'
  2. means return same type and parts of the original data

And those are the base rules of how to constitute chars, e.g.

http://www.yanying.wang/ming/naming-rules.html

. People who only have the experience of Western languages may have the impression that Chinese characters are complicated, but I'll say it is proportionate to the amount of information it implied. And from that point of view, those chars are really simple.

By having those features, the code would be appeared in a much more understandable way, because you can guess out the parameter and result to some degree:

check out the preceding pictures, when you see chars have the appearance of , you can guess out it is related to the numbers.



http://www.yanying.wang/ming/numbers.html


I'm not a language specialist, but what I can see the drawbacks of a language like English is that when you want to form out a complex similar concept (e.g. ice cream) from the base concept(ice, cream), you can not always use the base concept word, because firstly the length would be long enough for you to give it a different shape name.

1 Like