"Go" program language with their tools

Source: Internet
Author: User
Tags jprofiler

Talking about so many programming languages, as if the language is good or bad is the decisive factor in choosing them. However, one of the problems I have never mentioned is that the design of "programming language" and "programming language tool" is actually a different thing. A good programming language, may be due to the designer's neglect or lack of time, not provide a good auxiliary tools. And a not good programming language, because of the use of more people, often someone will spend a great effort to design tools for it, the results greatly improved ease of use and programmer productivity. I have mentioned that programming languages are not tools, they are materials like wood, nails, glue. If a company makes very good glue, the stickiness is very strong, but its packaging is not good, the opening is running around, making a mess. Are you willing to buy such glue or is it a little short but sticky enough, packaging design is reasonable, easy to apply, easy to store it? I think most people will choose the latter, unless the latter's stickiness is too weak, then the packaging is no good.

That's why, although I appreciate scheme, I don't use scheme or Racket to construct Pysonar and Rubysonar, not even Scala and Clojure, but "notorious" Java. This is not just because Pysonar's original code is written in Java because of the project, and because Java has enough expressive power to implement such a system, the most important thing is that Java's tools are very mature and fast. It's hard to imagine that I could have done something like Pysonar in three months without Eclipse. And now I have only one months to make a rubysonar, which is a great credit for IntelliJ. These IDE jump functions allow me to freely travel through the code. And their refactor function, let me no longer worry about the name of the variable, because as long as the temporary start a non-repeating name on the line, later changed to a piece of cake. In addition I often use these IDE's debugger, use them I can easily find the cause of the bug. PySonar2 in a period of time to become very slow, do not see where there is a problem. Finally I downloaded a Jprofiler trial version and soon found out where the problem was. If this problem appears in the Scheme code, I'm afraid it will take a lot of effort to find it, because Scheme doesn't have a tool like Jprofiler.

But this does not mean that learning Scheme is useless. On the contrary, the knowledge of Scheme is very useful at all times. A programmer who has only learned Java is basically impossible to write Java code like me. Although it seems to be Java, the spirit of Scheme has been incorporated into it. The knowledge I learned from Scheme not only lets me know how Java can be used, but also lets me know how Java itself has been created. I know where Java is good and where it's bad, so you can choose to be good and avoid it. My code doesn't use any Java design pattern, nor does it have a roundabout overload.

In fact, I have time to design and implement my own language (because of the lack of imagination, temporarily named Yin), its implementation of the language has recently been replaced by Java. Yin's syntax is close to scheme, as if it should be implemented with scheme or Racket. Some people may have seen my first prototype implementation on GITHUB (the project has entered the private state) with Typed Racket. Racket is a much better language than Java, but it has a problem that annoys me so much that I finally wonder if I can use it to make my language go smoothly.

The problem is that when the error occurs, Racket does not tell me the exact line number of the error code, or even the cause of the error is not clear. I often see some of these error messages:

“函数调用参数个数错误”“变量 a 没有定义,位于 loop 处”

It's just a function call, the function is called what name does not say. Just say loop, so many loops in the file, which one does not know. Error message There are often a lot of other spam information, you point to the Racket system inside a file. Sometimes the code is copied into the Drracket to find the location, but many times even drracket are not. Whenever I encounter these, I am interrupted for a long time, resulting in a drop in the quality of the code.

Other Scheme implementations have similar problems, such as Petite Chez is more serious, only the commercial version of Chez Scheme will be better, so here is not just a small criticism. This is not a mind for tool design, and is very common in the community of functional languages such as Lisp and Scheme. Whenever someone complains about their error message confusion, no debugger, no basic static checks, the hardcore schemer will despise you and say: "Aziz said well, I never debug, because I never write bugs." "" Functional language programming is not the same as normal language. You have to first debug the code of the small piece, the problem has been found, and then combined together. "When the program has a problem and can't find where it is, it means I'm confused, I'll rewrite it ..." I have no words, genius is so legendary:)

In addition to being arrogant, Scheme does not provide another important reason for the wrong location, in fact because of its macro system. Since the core of Scheme is very small and is designed to be extensible into a variety of languages, most of the code is actually expanded by macros. And because Scheme macros can contain very complex code transformations (much more powerful than a C-language macro), it is difficult to trace the code that the programmer wrote itself if the code being expanded is problematic. Even if you find it, it's hard to know what that piece of code is, because the compiler sees only the code after the macro expands. If the implementation of the diagram simply did not put the original location information, then there is absolutely no way to find. This is a bit like some C + + compiler error message to the template code.

So it is not only the problem of language designer's mentality, but also the design problem of language itself. I think that LISP's macro system is actually a superfluous thing that brings more trouble than good. A language should be used instead of extended. If even the most basic error information can not be accurately located, the ability to expand strong and what is the point? So emphasizing that a language can be extended or even become another language is, in fact, overly abstract. A well-designed language should basically not need a macro system, so the grammar of the Yin language is like Lisp, but I won't be able to provide any macros. And as a result of the above experience, the Yin language from the beginning for the convenience of the design of tools to make an effort.

"Go" program language with their tools

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.