Slashdot Mirror


Eclipse Launches New Programming Language

An anonymous reader writes "Eclipse has launched a website for a new JVM language, called Xtend. It's built with Eclipse's Xtext and compiles directly to Java code, similar to what CoffeeScript does to Javascript. It's not just an announcement but it's already there and useable, including a very feature-rich Eclipse integration."

28 of 238 comments (clear)

  1. I like it by msobkow · · Score: 2

    I like it. It looks like they've taken the power of C/C++ macros, wrapped it up in a clean simple syntax, and applied it to Java.

    When I first started programming in Java, I was at a loss without my macros. The concept of macros and code expansion are so powerful, but often overlooked because they can be hideously difficult to debug and enhance.

    --
    I do not fail; I succeed at finding out what does not work.
    1. Re:I like it by nepka · · Score: 2

      The concept of macros and code expansion are so powerful, but often overlooked because they can be hideously difficult to debug and enhance.

      And leads to extremely bad code. Goto has the same thing - it can be extremely powerful, but overusing it leads to really bad code.

    2. Re:I like it by Anonymous Coward · · Score: 2, Interesting

      The concept of Lisp macros and code expansion are so powerful, and they are easier to debug and maintain because they are not merely a matter of replacing strings (rather, the postponing of evaluating a lisp form so that you can modify the language).

    3. Re:I like it by onefriedrice · · Score: 3, Interesting

      And leads to extremely bad code. Goto has the same thing - it can be extremely powerful, but overusing it leads to really bad code.

      It's not so much about overuse. Rather, it's the misuse of macros and gotos (and any other coding construct) that can lead to bad code. Macros and gotos get a bad rap because they get misused more often than other constructs, mostly by those who are really new to programming. When used appropriately, these constructs can make code more readable and easier to maintain. It's too bad that so many students are being taught to avoid gotos at all cost; better to teach them when gotos can be used to good effect.

      --
      This author takes full ownership and responsibility for the unpopular opinions outlined above.
    4. Re:I like it by Paul+Fernhout · · Score: 2

      Me too, for use with the Java ecosystem. They've taken some good ideas from Jython and Smalltalk. I wonder how smooth debugging is though?

      --
      A 21st century issue: the irony of technologies of abundance in the hands of those still thinking in terms of scarcity.
  2. Groovy / Scala by Anonymous Coward · · Score: 2, Interesting

    Does it do anything that Groovy or Scala don't already?

    1. Re:Groovy / Scala by osu-neko · · Score: 2

      Does it do anything that Groovy or Scala don't already?

      Does any language do anything that any other Turing-complete language doesn't do? Doesn't seem like a sensible question. A more intelligent question would be, "Does it do anything differently?" And yes, it does.

      --
      "Convictions are more dangerous enemies of truth than lies."
  3. Eclipse by ZankerH · · Score: 5, Funny

    The "You want performance? Fuck you, have more features instead!" of IDEs.

    1. Re:Eclipse by kestasjk · · Score: 2

      Performs fine here..

      --
      // MD_Update(&m,buf,j);
  4. Re:Why? Because! by tomhudson · · Score: 4, Insightful

    "We saw what you did with your classes, so we added some more classes to your classes to hide your classes because we have more class."

    "We saw what you did with your syntax so we added some more syntax to your syntax to hide your syntax because we are more syntaxy."

    "We saw that java still sucks so we added some more suckiness to java's suckiness to hide java's suckiness because our suckiness sucks less ... sort of ... maybe ..."

    "... because our next step is to distract you from our new suckiness by adding more xml ..."

  5. Java needs new versions by bigsexyjoe · · Score: 2, Interesting

    Seems like cool language. Much like Spring and the new JVM languages, it seems like this exists primarily to address shortcomings that Java has because it hasn't come out with new versions for so long.

    Eclipse already writes a lot of Java for you, so this seems like a natural extension. Of course, this is a ridiculous state of affairs. When a most code in a language is boilerplate, it's time for a new version, that takes care of that for you. I mean could you imagine anyone releasing a Java-like language today that didn't have first class treatment of properties, didn't have syntax for applying a function to every member of a collection, and didn't have better type inference?

    It's interesting that it compiles to Java, I don't think it'll be long before, it'll start to completely skip the Java phase.

    1. Re:Java needs new versions by hibiki_r · · Score: 2

      7 was almost a minor revision when compared to anything Microsoft is doing, or with 1.5 and 6. 7 actually looked promising at first, but pretty much every single feature that seemed like a game changer was delayed.

      There's tons and tons of libraries out there that try to emulate what other languages can do, and do it with horrible style due to Java's approach to syntax. Just look at Guava Collections: A large array of workarounds for features that the language should support. But predicates that come with a penalty of 4 lines of noise aren't really any better than dealing with iteration yourself. Jumping through hoops to initialize a map in a concise way? Having to build a full inner class for a one use, one line comparator? Why is there no way to let the compiler create getters and setters upon request, instead of filling codebases with hundreds of lines of code that are sheer noise?

  6. Re:Reinventing Emacs Lisp... by Mitchell314 · · Score: 2

    "but"? I think you meant "Also". :P

    --
    I read TFA and all I got was this lousy cookie
  7. EMF by prefec2 · · Score: 4, Informative

    We are using Xtext (2.0) and its companion Xtend (2.0) to build domain specific languages. Together with Xbase, a part grammar for expressions, we can build new DSLs for various purposes in no time. And it is not such a code bloat as some people might think. When you develop applications with a wide range of models, these EMF-based tools are quite practical. Beside that, we evaluated ATL, QVT, and Xtend in various scenarios. Right now it looks like, that Xtend is very well suited to build generators to source code of other languages especially Java and Scala. It also made a good impression in model-to-model transformations.

    1. Re:EMF by TuringTest · · Score: 2, Insightful

      Meet the new slashdot, where technical programming posts that actually give insight are met only with trollish hate and a general lack of understanding. Learn to Google your TLAs before exposing your lack of skilz, kid.

      --
      Singularity: a belief in the "God" idea with the "demiurge" relation inverted.
    2. Re:EMF by TuringTest · · Score: 2

      What kind of models do your applications support, and in which industry (or industries) are they used?

      I'd love to hear about how one gets to be an expert in model-driven programming.

      --
      Singularity: a belief in the "God" idea with the "demiurge" relation inverted.
    3. Re:EMF by prefec2 · · Score: 3, Informative

      I work at university right now. We have a lot of projects together with software companies. I for myself are in a project were we design a language and tools to develop railway control centers based on programmable logic controllers (PLC) with Funkwerk-IT. That means our target languages are the IEC 61131-3 languages (e.g., FBD, ST). The general idea is, that you can model your railway control business logic in an appropriate language instead of coding it in FBD or ST. Part of the project was the design of a railway topology description language (and meta-model) which has been a valuable input to their own projects.

      In another project about scientific workflows, a colleague of mine is writing an BPNM to BPEL converter in Xtend. And transformations for some scientific workflow notations (SWN). Here the big thing is that SWN are data flow oriented while BPNM and BPEL are control flow oriented.

      A third project is about measuring software properties, based on their code and composition (architecture) and to monitor their run-time behavior. This effort is called MAMBA and will hopefully be presented at CSMR 2012.

      Personally I used Xtend and Xpand a year ago to wrote an application based on JSF/Richfaces and all that stuff and I had to do a lot of similar things in the backing beans for my templates. So I wrote a small Xtext grammar and a generator in Xpand (utilizing also Xtend) to produce this similar code. It gave me quite a boost, as there was now less space for errors. The language itself is ugly and can be made better, but it took me a workday to build it including the generator.

      The best thing about modeling, you can concentrate on the problem domain and forget about the implementation domain while formulating thing for the problem domain. Well, this is not new, XML and XSD went down the same path, however, the EMF tools are better integrated and they are closer to the data processing while XML is closer to data storage (conceptually).

    4. Re:EMF by prefec2 · · Score: 2

      Well the interesting thing is: I was talking about http://www.eclipse.org/Xtext/#xtend2 which looks for me by any definition exactly like http://www.eclipse.org/Xtext/xtend/ . However, xtend2 is different from xtend+xpand which were its predecessors [http://www.eclipse.org/modeling/m2t/?project=xpand]. So reading the news (again), I found out that the Eclipsians see the language in a quite different light as the modeling guys from itemis. But I am absolutely sure that this is the same language. Otherwise I would be wondering, why these two languages have the same syntax and are both based on xtext.

    5. Re:EMF by prefec2 · · Score: 2

      Yes it is different from the old oAW stuff. However, the Xpand language is now part of this new Xtend. You can use guillemont-expressions in text expression e.g., '''Some Text >''' which is a Xpand-Expression inside the '''...'''. However, all the foreach macros and templates form Xpand are gone, as there are similar constructs in Xtend.

  8. Re:Why? by SplashMyBandit · · Score: 3, Insightful

    You do know that the Java runtime is an order of managitude smaller than the .NET runtime dont you (and that is not even considering that .NET also requires the bulk on Windows while Java does not). In short, your knowledge is severly out of date - you musta been drinking the Microsoft koolaid. Well, here is news for you, .NET will be superceded by another Microsoft product long before people stop using Java (especially in the Enterprise space).

  9. Re:Here comes the injenction by SplashMyBandit · · Score: 3, Informative

    Who cares if Oracle kill their Java. The Free Software OpenJDK is where the action is at. Then there is IBM Java, and GNU gcj/classpath, and Kaffe, and others. It is not a situation like .NET where if Microsoft kills it then it'll die everywhere (due to the proprietary licensing).

  10. Re:Why? Lightweight? by Meeuw · · Score: 2

    To have the .NET framework backwards compatible (like Java) you'll need to have all .NET frameworks installed which requires 4 GB. In what universe is that lightweight?

  11. Re:Why? by HiThere · · Score: 2, Insightful

    Yes. Java was (and is) a lot faster than Smalltalk. Sorry, but that *is* significant.

    Of the languages that you list, only Lisp is faster, or even nearly as fast as, Java. And Lisp is hard to wrap your mind around. (And here I'm assuming that you mean compiled Common Lisp.) Also, in the early years of Java, a free compiler was unusual. Having a language with a free compiler was a real win. That's much less a consideration now, but now that shape of the language landscape has a lot more inertia.

    --

    I think we've pushed this "anyone can grow up to be president" thing too far.
  12. Re:Experienced Xtenders wanted by prefec2 · · Score: 2

    Well. This would be possible. The predecessor of Xtend (2) was Xtend (1) and Xpand which are the sucessors of the openArchitectureWare transformations. And 3-5 year of Xtend or oAW experience is possible. Nevertheless, I am waiting for some dumb job offer writing just like the one you sketched ;-)

  13. Re:Tell me it ain't C# by shutdown+-p+now · · Score: 4, Informative

    First we got told that writing person.name = "John" is bad. Bad, bad, bad. I never understood why.

    I don't know who said that it's bad, but certainly no-one sane.

    What was said is that you need API transparency, such that, if you later need to add validation that prevents person.name="" from compiling, you don't have to change the clients in any way. In Java, it was not given proper consideration when designing the language, and so the only workaround was to pre-emptively wrap all fields in get/set methods, and only use the latter from other classes, so that, if you ever need to add some code there, you can do so. However, the fault lies squarely with the language here. For example, in Eiffel, public fields are absolutely normal, because field access is indistinguishable from no-arg method call on API client side, so you can always substitute one for another.

    (By the way, if anyone tells you that writing one-liner get/set methods which do nothing but directly return or set the field is "encapsulation", it's the best indication that person saying so only knows OOP as a cargo cult, where they use specific words without properly understanding their meaning - as if they were some kind of powerful spells that magically solve problems by merely being mentioned.)

    In a previous job, I inherited C# code that had statements like db.open = true. Whaddya think that meant? Why, it opens the db connection, via the setter, of course! And indeed, assigning false...

    Would it be any better if it was Java code that had a method named setOpen()?

    In reality, it boils down to giving sane (i.e. principle of least surprise) semantics to class members. Whether they are properties explicitly because the language allows it, as in C#, or implicitly defined by their name by convention, as in Java, the expectations are the same. I use a few simple rules to determine if something should be a property:

    1. If (foo.Bar != foo.Bar) - i.e. if reading the value twice without doing any other changes to the global state of your system gives two different values - then Bar should not be a property.

    2. If, after setting foo.Bar = x, getting it returns something different from x, then Bar should not be a property. This one is arguable, since some people like to put normalization code in property setters - trimming strings, replacing nulls with blanks etc. Personally, I disagree with that practice; however, the rule applies even then, you just need to use the common sense definition of "same" and "different" - i.e. not operator==, but what makes most sense for value domain of that property.

    3. If setting foo.Bar = x, for any x, can throw any kind of exception other than the one indicating contract violation by the caller (e.g. in .NET, ContractException, ArgumentException or InvalidOperationException), then Bar should not be a property. A "contract exception" is defined as one that sane callers should never catch (.NET 4+ enforces this by making ContractException internal). Most certainly, something throwing IOException or SqlException or similar things is absolutely not a property.

    4. If reading from or writing to foo.Bar cannot be safely done on the UI thread for the fear of blocking it long enough to adversely affect UI responsiveness, it should not be a property. This one is also subjective, since it does not define "long enough" or "adversely affect", but it's one of those cases where you know it when you see it.

  14. Re:Yet Another C Variant (YACV) by shutdown+-p+now · · Score: 4, Insightful

    Can we please get C with sane declarator syntax? And some form of generic programming? And function literals? And a better-working separate compilation model that doesn't require people to wrap their entire interface declaration in #ifdef/#endif?

    Then, yes, we can just program in C.

  15. Re:Why? by epyT-R · · Score: 2

    .NET runtime is lightweight? I wouldn't count windows, xbox, and wp7 as 'multiplatform.'

  16. Re:Tell me it ain't C# by Xest · · Score: 2

    "Many people, even some IDEs, insist on generating getters and setters, even when there isn't a JavaBean in sight."

    Yes, but that's precisely to cater to the case that in future, there may be a need to do something else. It's partly more problematic with Java because in C# it's quick and easy to do:

    public string Name { get; set; }

    Whilst in Java, it of course takes longer and creates more code clutter to do:

    private string _name;

    public getName() { return this._name; }
    public setName(string name) { this._name = name; }

    Of course, C# properties aren't perfect, unless you do things in a more Java-esque way and don't use the automatic properties feature of C# 3.0 they force you to instantiate back in the constructor which is one of my bugbears with it, although some would argue that's how it should be done anyway.

    The issue is largely that if you change simple fields into properties (or getter/setter pairs in Java) later on because you genuinely do need to do something when the variable is read or set then it can be a breaking change, by doing it from the outset then that's not the case. It's about minimising the potential impact of future changes, and you simply never know how long your code will be out there how it will be used, how it's use will change. Getters and setters insulate from that.

    "The database open assignment was a case in point. It should just have been something like conn.dbOpen()"

    This IMHO was an example of bad use of properties, see point 3 of shutdown -p's original response to you as to why, not to mention the risks you potential face by way of resource cleaning in doing this sort of thing. Anything can be misused, but I do not believe it's a fair argument against the feature, because the feature in the hands of competent developers certainly leads to much better code. I'm not a fan of catering to the lowest common denominator, HTML5 does this and it's an awful spec with so many missed opportunities (i.e. it makes accessibility worse, it lowers software development quality standards reducing maintainability etc.) - effectively it makes crap markup standard make crap, poorly maintainable, poorly accessible markup standards compliant, rather than raising the standard to allow things to move forward as XHTML has done by increasing the amount of XML parsable (even if not served as XML) markup out there.