Why MPS is better than lisp?

MPS. New concept? Started in 2003 as a research project? Have code not as a text but as AST?

People, you have never heard of Lisp?

1
7 comments
Avatar
Permanently deleted user

We heard this argument that we didn't create anythinhg new and lisp is a better solution many times. Interestingly, many people who tell us things like this don't even tried to download MPS and try it. We have taken look at lisp, we know what it is. It has similarities with MPS but MPS is different. You can think of MPS as more advanced development of ideas behind lisp. I'll try to compare these technologies:

  • lisp has hard to read syntax based on S-expressions. MPS has readable and customizable syntax
  • The only aspect which lisp has is generation. MPS has much more aspects: scopes, constraints, typesystem, error checking data flow analysis
  • Lisp doesn't have unified IDE support. Even more, I don't know any thing which can be called IDE (something like IntelliJ IDEA) for lisp. MPS provides many IDE things automatically: completion, error highlighting, navigation.

P.S. I recommend respect people in this forum and choose more polite and informative topic names, for example instead of Ha-ha-ha-ha you could have written why MPS is better than lisp.

0
Avatar
Permanently deleted user

    

I downloaded MPS and started the tutorial, but indeed, the comment was made before this.

The comment was made right after reading the front page.

The Overview stating that MPS is "the brand new concept of programming". "It makes sense to extend the existing languages to create more domain-oriented ones, which allow writing programs on a higher level and in a manner that is more natural to each domain. With an instrument that allows creating language constructs as simple as creating classes or methods in a conventional language, you can significantly change the way you develop software".

After that I switched to the How It Works section and discovered that "The problem in extending language syntax is mainly the textual presentation of code. This is especially true if we want to use different language extensions, where each one may have its own syntax. This naturally leads to the idea of non-textual presentation of program code. A major benefit of this approach is that it eliminates the need for code parsing. Our solution is to have code always maintained in an Abstract Syntax Tree (AST), which consists of nodes with properties, children and references, and fully describes the program code."

I was really laughing aloud at that moment. This brand new concept sounds very familiar.

Benefit of possibility for a programmer to extend the language is well understood. Employment of program-as-a-data-structure for this extensibility is also known for a long time. And suddenly it is proclaimed to be a new XXX Oriented Programming.

I admit the tone of the comment is somewhat offensive. Sorry.

The tone was partially motivated by a kind of jealousy: "I already know this!". This is stupid because I by no means own the ideas I know. 99.99% of things I know were not invented by me.

The question was neither "Why MPS is better than Lisp" nor "Why MPS is worse than Lisp", but rather "Is MPS a brand new concept".

I am not saying that there is nothing new in MPS (I don’t know it sufficiently yet). But the key things listed on the front page are already known. Again, this does not make MPS worse. If some of the features in your system are rediscovered yet again, this only proves they are objectively natural for computer programming.

0

Hi Anton,

We've updated the wording on the page so it is more correct now.

Thanks for the pointing it out.

Looking forward to your comments on MPS

-Eugene

0

"...This naturally leads to the idea of  non-textual presentation of program code..."

Well, this certainly isn't the best part in MPS  documentation.

Respected James  Watson has been (arguing a lot) that MPS languages are based on XML and therefore are still  text-based.

Probably, we undersatand 'text'  in a different ways.

In the classical, text-based  technology, there are basically two requirements for program's  'text':

- it *must* be  machine-understandable in the sence that computer must be able to parse the  program's 'text' to ast;

- *nice* if human can read it  too. But if not.. well, at least computer can. (are you saying you can read lisp  fluently? you are genius probably. you can LOL at everything then,  certainly)

In MPS, we are presenting  program as a text (on screen), but we eliminate the 1st limitation  above.

The new requirement  is:

- program's text must be easily  understandable by human or anything else who don't parse texts using grammars  from text book on computer science.

Humans (thanks God) are using  somehow different technology while reading texts.

We, in JetBrains, don't know  what that technology is, but we think we know enough to try to exploit it. Thus,  we don't parse either.

This is essence and this is the  novelty of MPS.

You knew that before? Why not. Did you read about it? Do you know other such products?

I would very appreciate  references.

0
Avatar
Permanently deleted user

Igor, I do not have any misconceptions about "non textual" nature of MPS.

I'd say MPS explores two, closely related, aspects of being "non textual".

First, is that program code is represented by data structures. Programmer may introduce new language constructs by defining new kind of data structures. The semantics of the new construct is specified by programmer via interpretation of that data structure (without parsing any text by grammar rules).

Did I know this idea before? Yes. This is exactly how Lisp works. I believe this "code as data", "reflective language", etc, idea is also used in other systems/languages, but Lisp is the most obvious example.

The second aspect is the editor, where we do not edit text, but directly manipulate the data structures forming program code. (Of course, not really "directly", because we use mouse, keyboard; some intermediate representation when we type in text fields, etc. But you understand what I mean).

I do not think textual representation and “non text oriented system” are necessary mutually exclusive, but perhaps I’ll make a separate post about this.

As far as I remember, MPS editor is the first programming IDE of that kind I personally tried. But in general in programming, other researchers were exploring this idea too.

For example, you might find interesting the Subtext project - subtextual.org. This project is a research and doesn’t have ready to download system. But there are text papers and video presentations. I didn’t find time to really learn Subtext, but the project seem to investigate in similar direction with MPS (and it’s author seems to be digging very deep).

Here is the starting paragraph from its 2005 paper (linked on the site as “original paper” in contrast to the 2007 paper describing the current state):

Representing programs as text strings makes programming harder then it has to be. The source text of a program is far removed from its behavior. Bridging this conceptual gulf is what makes programming so inhumanly difficult – we are not compilers.

This paper and the site in a whole have a lot of references and reasoning about the place of the project’s approach in historical context.

In particular the paper refers publications about “syntax-directed editors” or “structure editors”, which, from the description in the Subtext paper, seem to be very similar to MPS’s approach.

BTW, interesting quotation “Syntax-directed editors met resistance from practicing programmers [26]. A common complaint was that forcing the program to be syntactically valid at all times blocked well-worn shortcuts through invalid states.” I felt somewhat similar inconvenience in MPS editor. When during the Calculator Tutorial, I created method main as non static. I didn’t find a way to turn it into static method and ended up by retyping everything from scratch in the static method section of class template. Perhaps there is some command I overlooked; otherwise maybe it’s an issue to be addressed in further MPS development.

Another example would be Interlisp system. It also had structure editor, which operated not on sequence of characters, but directly on data structure representing program code.

This is only what I know. I am sure more analogues may be found if one is interested.

0
Avatar
Permanently deleted user

MPS must store somehow its models, languages, etc. It was not surprising to find them stored in XML files.

After completion the Calculator Tutorial, I even tried to program directly in the sandbox.mps file. In addtition to input fields price and count created with the help of MPS IDE, I created input fileds distance and distanceFactor and another output field whose value is calculated by the formula:

distance*distanceFactor / (count == 0 || price == 0 ? 1 : price*count)

Here is the resulting XML. Generated Java works fine:

calc.png

Was it difficult? Not very, even easier then I expected; despite the fact that MPS XML format is verbose and is not suited to be edited by human. In fact only few attributes of <node> must be changed after copy/paste. Something I did by analogy with existing code in the file; other things I found in the MPS broser (Ctrl-H on Expression concept shows all the possible expression clauses).

What does it mean, that MPS stores code in text files? Does it turn MPS into a text based system?

Not, of course.

The key point is not what we see on screen or what we type, but what our programs work with.

If our extentions to compiler (generator in MPS) receive data structures on input and produces data structures as an output, it doesn’t matter where the input data come from: from text, graphics or voice commands. Our code knows nothing about the (external) source form.

This also means that textual representation is not necessary evil. Generally speaking, several external forms may represent the same program. In many cases it may be convenient to work with textual representation of the program data structure. Especially when this textual representation is designed with such a usage in mind.



Attachment(s):
calc.png
0

Hi all!

15 years later, I have something to contribute to this interesting discussion. I had the same question very often and finally have my answer. It took me quite long to accept that MPS is innovative and worth all the effort of learning it.

I think, the original authour had in mind that in LISP code is data. When reading "code is AST" he thought that this is like in LISP. But he is wrong. Because MPS is not about coding. MPS is about languages and data (and it can be also used for coding). But LISP is only about data and code, but not about languages.

That means, in LISP you will not have a comforatable editor for your data. You must use the LISP parenthesis notation. When you accept this, then you are probably more powerful than with MPS. But that was not the deal. We want to have languages and language editors and not s-expressions. That is what makes life easy. And that is what LISP does not have and makes MPS so innovative.

Apart from this, MPS and LISP are actually similar. Because MPS provides a code is data approach. For example a concept or editor definition is data. When building the language, this is converted into code and then compiled. And when for example going in the ispector of an editor definition to "show if" or when using a model access cell, then there is code. Code in date. What MPS makes so powerful and innovative is the mixture of code and data everywhere.

And that is not new, at all. LISP does this. LISP does this even better. I think, in MPS everything is quite complicated. Only LISP developers can understand, what I mean. Such programming style is really the strength of LISP. And always clicking on the "Rebuild all" button in MPS is also annoying. In LISP this would not be required. In LISP everything would be very seamless.

So, in conclusion. MPS cannot be compared with LISP. MPS does much more than LISP. MPS is an editing framework. But LISP is only another programming language like Java. I agree that LISP is the better programming language that even does many things that Java con do only with MPS. But I want to use comfortable tools and languages and not always do programming. For me it would also make MPS more attractive if it would have been developed in LISP instead of Java. But this is not the case. The decision in what programming language it is developped does not make MPS worse.

0

Please sign in to leave a comment.