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?

6 comments
Comment actions Permalink

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
Comment actions Permalink

    

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
Comment actions Permalink

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
Comment actions Permalink

"...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
Comment actions Permalink

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
Comment actions Permalink

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

Please sign in to leave a comment.