Song benhong (Ruby inventor): How Emacs has changed my life

Source: Internet
Author: User

For the original (English version), see here.

Here are some of my translations and technical background documents:

In 1980, I started programming. 2 Basic, 400 steps (I do not know how to translate) 3 in 1988, I met Emacs and shared it with more than 200 students on Sun-3 in the school. 4. emacs is actually disabled because it consumes too much memory. so I just tried it. 5. I can freely download Emacs and read its source code. 6. emacs is my first lisp interpreter. 7. I learned a lot about language implementation from Emacs. 8. For example, emacs integer implementation (embedding integer in pointers)

Refer to the definition of lisp_object. in H, lisp_object is a type code that can be used as both a pointer and an integer. For details, see. Note that lisp_int is 0, so that non-negative integers can be directly converted to the corresponding list_object type:

#define VALBITS 29#define GCTYPEBITS 3enum Lisp_Type  {    Lisp_Int = 0,    /* Symbol.  XSYMBOL (object) points to a struct Lisp_Symbol.  */    Lisp_Symbol = 2,    /* Miscellaneous.  XMISC (object) points to a union Lisp_Misc,       whose first member indicates the subtype.  */    Lisp_Misc = 3,    /* String.  XSTRING (object) points to a struct Lisp_String.       The length of the string, and its contents, are stored therein.  */    Lisp_String = LISP_STRING_TAG,    /* Vector of Lisp objects, or something resembling it.       XVECTOR (object) points to a struct Lisp_Vector, which contains       the size and contents.  The size field also contains the type       information, if it's not a real vector object.  */    Lisp_Vectorlike = 5,    /* Cons.  XCONS (object) points to a struct Lisp_Cons.  */    Lisp_Cons = 6,    Lisp_Float = 7,  };typedef union Lisp_Object  {    /* Used for comparing two Lisp_Objects;       also, positive integers can be accessed fast this way.  */    EMACS_UINT i;    struct      {        EMACS_INT val  : VALBITS;        enum Lisp_Type type : GCTYPEBITS;      } s;    struct      {        EMACS_UINT val : VALBITS;        enum Lisp_Type type : GCTYPEBITS;      } u;  }Lisp_OLisp_Stringbject;
9. For example, the memory automatic recovery mechanism of Emacs (mark and sweep garbage collection)

For details, refer to the discussion here.

10 C and lisp calling conventions ...) 11. I fully understand how lisp works. 12. I was fascinated by LISP objects. 13. When I got a Linux workstation, I started to use emacs14. I was totally fascinated, emacs is part of me. 15. I can modify any part of Emacs that I don't like. emacs is completely configurable. 16 Emacs makes me understand that everything can be changed by programmers 17 completely free when editing 18 can ignore the keyspace setting 19 I want to use Emacs to do everything, programming, documentation, mail... 20. So I wrote "CMail", my first serious lisp program. I used it every day in 1993. I started to develop my ruby22 Ruby design and was affected by Emacs implementation, for example, integer and tagged pointer are used together, similar GC, and object model similar to lisp

For details about tagged pointer, refer to the C code above. The 3-bit high address is used to identify the data type, and the 29-bit low address is used as the pointer or INTEGER (depending on the data type)

23. Next I will add the OO system of Smalltalk to the 24 syntax. I use ALGOL/ADA/eiffel25, but I am an Emacs enthusiast. So in Emacs, supporting auto-indent is mandatory 26 in 1993, similar syntax to support auto-indent is difficult 27 so I wrote my own ruby-mode.el, trying to solve this problem with elisp and regular expressions (RegEx. 28 a week later, I finally succeeded after adding the end keyword to Ruby 29. If I cannot make the ruby-mode under my Emacs successful, the ruby syntax will be similar to other scripting languages like C30, and Ruby will not be so popular.
  • Emacs teaches me what is freedom for Software)
  • Emacs teaches me how to read code
  • Emacs makes me realize the power of LISP
  • Emacs teaches me how to implement the language core
  • Emacs teaches me how to perform automatic memory reclaim (Garbage Collector)
  • Emacs helps me write code and debug
  • I use Emacs to write a document email
  • Emacs makes me an efficient programmer
  • Emacs makes me a hacker
  • Emacs has always changed my life.
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.