It is a pleasure to chat with the great gods. This is not because I am excited, but because every word that the great god says is valuable. As for why again, of course this happened before.
For the first time, I met Yan Minmin in high school. At that time, I just finished that silly 2D arpg. Soon, Yan Minmin was already an intern at M $ Ra, and he must have a much higher level in graphics than I did, the gaps constitute the relationship between the great gods and cainiao. Of course, even though the center is already inProgramDesign Language (PL), but also know some graphics content, the gap with Min has naturally narrowed down to a level that does not constitute the relationship between God and cainiao. Although he knows a lot more than me.
The second time I met g9yuayon at university. G9 chicory is formal and proven, and naturally knows a lot about Pl. When I was a sophomore, I accidentally found G9 Chicory's blog on csdn.ArticleIf you write well, send the email "password" on the blog to him after it is broken. Later G9 chicory told me a lot of things, such as where to obtain knowledge, so I did Pl. Although I have little contact with G9 chicory, I feel that the gap between me and G9 is still related to the great gods and cainiao, because I still cannot fully understand the blog he wrote a long time ago.
The third time is today's events. Everyone knows that I am writing a series of articles about how to design a language recently. This series of articles will certainly continue to be written, because I haven't made any language yet. So it is obvious that I am also working on a language. This is of course different from the one of Wang Yin, because I didn't intend to replace everything from the very beginning, and the goal was also very clear, just make it the same as C ++/C #. cainiao can easily get started and write it clearly and easily.Code, The great gods can also find a lot of tricks and tricks in it. So I inevitably encountered the problem of CPS.
We all know that C # has two keywords: yield and await, and F # also has computation expression. So I was wondering what would happen If yield and await were not keywords but a function. To expand, it is to let programmers implement a CPS transformation for specific purposes. What should I do with my syntax. For those who have not designed programming languages, it is easy to misunderstand "design a syntax. The syntax does not mean that we should put a bracket here, put a keyword there, and omit something else (look at Go and copy the semicolon like JavaScript to omit the policy ). These are all issues of taste. Taste does not need to be designed. It depends on feeling and is an art. As long as you think it is beautiful, it is good. What really needs to be considered is naturally the type system around the morning.
I will explain in an easy-to-understand way what a type system is, or what the program looks like in the eyes of those of us who work as Pl. Let's take a C # asynchronous program as an example.
Async VoidButton4_click (ObjectSender, eventargs e ){Try{StringA =AwaitHTTP. downloadasync (url1 );StringB =AwaitHTTP. downloadasync (url2); textbox1.text= A +B ;}Catch(Exception ex) {textbox1.text=Ex. Message ;}}
Everyone is familiar with it. If this simple program still doesn't understand it, it must have not carefully read my "how" series. Well, now, how do PL engineers look at this program:
async void button4_click (object, eventargs) { try {string = await (string-> task
) (string ); string =
await (string-> task
) (string); (textbox -> string-> void # textbox. text) (Textbox, string +
string) ;}
catch
(exception) {(textbox -> string-> void # textbox. text) (Textbox, (exception->
string # exception. message) (exception) ;}}
Well, it looks like this. Whether this function downloads a pirated novel, a Japanese movie with a program, synchronous download, asynchronous download, or a folder, or download it to SkyDrive! I only want to see the type section here.
So what type should await be if it is a function? If yield is also a function, what type should it be? If this language allows programmers to create their own await, yield, and even the computing they want, how should I build a framework for them to set up in it, or what kind of relationship does the function meet in what context? I have been thinking about this issue recently.
At the beginning, I looked at the computation expression of F #, because this item of F # has all the functions I want. Later, when I wanted to move this feature into the system, I found that none of them could be set up. Of course, I soon discovered that this is actually because F # is still a function in the final analysis. It cannot write break, continue, or return in a for loop. F # is always a perfect for loop. However, my language is fine, so the type is not perfect-but it is a trivial matter. It is worthwhile to sacrifice a little perfection for ease of use. Of course, it is not worthwhile to sacrifice a lot of perfection to satisfy ease of use.
Since the for loop can contain break/Continue/return, the for function of "My computation expression, it cannot be something like ienumerable <t>-> (t-> m <u>)-> m <u>. What should I do?
Here, I think it is good to work at Microsoft. AboutProgramming LanguageMany improvements in the field are actually made from Microsoft. Let's take a look at the perfect C # and ASP. net MVC's razor template provides smart notification functions in Visual Studio-this is a code that can be mixed with HTML + CSS + JavaScript + C #. It is smooth and smooth During writing, the four languages are just the same. In terms of academics, Microsoft's research institutes have contributed a lot-but I don't think you are interested in this, although you have also used a lot of Microsoft achievements in Linux.
So what can this mean? This means that I can access the programming languages of Microsoft at any time and ask them questions. But they are very busy and often not online (we also have something like QQ ). But today I opened it and started the group of several great gods I had accumulated. I found that F # His father turned out to be green, so I sent a hi, let's see if someone else is absent. People returned to me, so I began to ask this question.
What, you don't know F # Who is his father? Of course he is Don Syme. Writing a functional language doesn't know Don Syme, It's like reading physics doesn't know Newton, reading mathematics doesn't know cool, writing C ++ doesn't know Bjarne stroustrup, like Dave Cutler, I had to kneel back to my school to study again. (Actually, this is just an art method. You don't have to worry about it. I don't know who they really don't know.)
Don Syme is the principle researcher of Microsoft. The translation is probably the meaning of "top-level scientists". There are very few things that are more awesome.
So the story ends here, because Don Syme quickly replied to me, if the for loop supports break/Continue/return, then I should not get inspiration from the computation expression of F. What should I do? This is still an open question. So our pleasant chat ended with the following sentence:
don Syme: Research