What's wrong with MPS
When I discovered MPS by accident the other day, I was quite excited to have a play with it, but after working through the tutorial I've lost much of my previous enthusiasm. I think the reason is that MPS (at least the tool, perhaps the language) is suffering from some of the same problems that EJBs and in particular Sun's reference implementation of an application server suffered from: It's just too fiddely to work with, it requires too many steps to do anything and when things go wrong, there is no good debug output. I know Lisp is a big no-no to alot of people, but Common Lisp's macro system is powerful, but quite simple and intuitive to use at the same time. Consider developing a Lisp macro to create your own 'timestwo' operator. Normally to multiply a number 'n' with two you do: (* x 2) Now, to extend Lisp's syntax (hmm) you simply do: (defmacro timestwo (n) '(* ,n 2)) Done. That's it. You now have an operator, called timestwo, which takes a number and multiplies it with two. Like so: (timestwo 5) =>10
As far as I understand MPS, doing something similar involves at least two tools, and creating generators, mappers and whatnot in various point and click submenus. I mean - perhaps MPS is more powerful than Lisp macros, or intended to do something different, but there's just too much crap to do. I shouldn't have to do all this, I shouldn't have to care, it should be autogenerated behind the covers for me!
Maybe what I want is the Java Syntactic Extender: http://people.csail.mit.edu/jrb/jse/index.htm
Or am I missing something? Is there something intrinsic about LOP that means the tool to use it must be so utterly - well unusable? (Even
when developed by the people behind the most usable Java IDE?)
</rant>
Please sign in to leave a comment.
Recently I've seen quite impressive video from PDC 05
http://microsoft.sitestream.com/PDC05/TLN/TLN306_files/Default.htm#nopreload=1&autostart=1
It is about language integrated query for .net (C# and VB). I believe that language extensibility model behind is much more powerful then even Lisp macros.
Igor.
>I believe that language extensibility model
Unfortunately I don't appear to be able to get the link
to work :-(, but I've heard about LINQ (and perhaps
even more interestingly lambda expressions and extension
methods) in C# 3.0
I found this link to be quite informative:
http://blogs.tedneward.com/2005/09/22/LanguageInnovationC30Explained.aspx
I don't necessarily think any of this is more powerful
than Lisp macros, but it's very cool to see added to
a language like c#. In fact I wish Java had something
similar, and I was hoping to MPS would do the thing
I wanted for this. However, as my main gripe was in the
original posting: simplicity appears not to be a design
feature.
Cheers,
Einar
Igor Alshannikov wrote:
Why is this project more powerfull than LISP macros? As far as I know in
Lisp macros you can do whatever you want with code, but LINQ project is
just syntatic sugar for common operation. You could read more about lisp
macros here http://www.apl.jhu.edu/~hall/Lisp-Notes/Macros.html
Thanks for link, interesting post.
.. Simplicity is essential but everything has its limits - language development cannot be as simple as language usage.
The tutorial is about first case and you are talking about second.
You don't extend lisp or describe new language when you define new macro.
Macros are unable to sweeten lisp syntax, right ?
"syntactic sugar" or "language extension" it makes no difference how you call it.
Queries are not part of C# or VB. Somebody behind the scene translates queries to language features : classes, method calls etc. (exactly like generators in MPS or any other code-generators).
And all this is possible because of certain extensibility model, which is quite powerful in my view.
(With the large caveat that I'm not a lisp programmer, and only have
cursory knowledge of the language)
Why not? Lisp has very little syntax - it's s-expressions, yes, but besides
that, there's not much syntax of note. You can add syntax, but that's
by using macros.
What extensibility model? Can I hack with it? (I'm not having a go, I'm
genuinely interested!)
Cheers,
Einar
AFAIU MS is going to open this model so that third parties could create extensions. But this wont happen soon - sometime after LINQ is released (which is preview now).
Best,
Igor.
Igor Alshannikov wrote:
What do you mean when you are talking about model?
As far as I know Linq only consists syntatic sugar that makes it is
possible to write
IEnumerable expr = from s in names where s.Length == 5 orderby s select s.ToUpper(); instead of IEnumerable expr = names .Where(s => s.Length == 5) .OrderBy(s => s) .Select(s => s.ToUpper());
It just replaces chained method calls with more pretty syntax. Code
simplification is a merit of lamda expression and type inference. You
can write similar code in Java and it won't be much longer or harder to
understand.
Also it has expression meta language, so it is possible to create syntax
tree with correct types instead of code generation and use it in
runtime. There is no any complex model here.