12 ms·
Eclipse launches new language to cut down Java boilerplate - Extend
- typicalrunt 15y agoVery cool. One nitpick (unless the video glossed over the details) is that the double arrows in the video for "personToGreet" looks weird because it's not a basic key on the keyboard.
- dserodio 15y agoNo problem, when you hit Ctrl+Space on the Eclipse editor it completes with a pair (opening and closing) these "chevrons"
- LeafStorm 15y agoAnd in other editors on non-Macs, using the US-International keyboard layout gets you guillemets (their proper name) with `AltGr-[` and `AltGr-]`. On Macs, they are `Option-\` and `Shift-Option-\` (not quite as good, but still there).
- haldean 15y agoWhat is Xtend supposed to provide that Scala doesn't already provide? It looks like their setting out to solve a subset of the problems that Scala deals with already.
- weego 15y agoby the looks of it, a decent IDE perhaps.
- SWengineer 15y agoI've found the open source version of intellij + scala plugin most impressive. Reliable code completion and everthing i've come to expect from a java IDE. I've had much less success with scala plugins for Eclipse and Netbeans. Without the intellij plugin for Scala I wouldn't have chosen Scala.
- theshadow 15y agoUnlike Scala it compiles down to Java. Depending upon how readable and sane the generated code is, I could see people working in organizations where Java is mandated write code in Xtend and then commit the generated Java code or use the generated code as base for code that get committed to official channels. Although I'm skeptical of how readable the Xtend generated Java is.
- lukejduncan 15y agoDoing so would mean it would need to be super friendly going the other direction. It'd be really annoying working in one language, compiling to java, having someone modify that java, and then needing to read and work through everything in java now.
- dextorious 15y agoFull blown first class Eclipse Java IDE integration PLUS a nice, conservative syntax that is not Scala.
- hopeless 15y agoOh, it looks like Xtend is to Java as Coffeescript is to Javascript. Although I'm sceptical about it compiling to Java source. Java seems to be going through a period of experimentation, and alternative Java-like and JVM languages. Interesting times.
- lemming 15y agoOne of the nice things about compiling to Java source is that it allows you use it with GWT. The only downside that I can see is that there might be constructs that you can't express in Java that you would want in a new language (note that you're fine with ones that you can technically express in Java but are just ugly, like closures). There are probably not very many of them, though.
- bunderbunder 15y agoI didn't notice any mention of taking care of the primitive/object divide. That would be high on my wish list.
- DanielRibeiro 15y agoWell, scala can be used with gwt: https://github.com/scalagwt https://github.com/scalagwt It was documented on scala, page, but now you have to use the google cache to see this: http://webcache.googleusercontent.com/search?q=cache:wqqu7uQ3v5cJ:www.scala-lang.org/node/11397+&cd=1&hl=en&ct=clnk http://webcache.googleusercontent.com/search?q=cache:wqqu7uQ...
- CarlSmotricz 15y agoExciting! Thanks for the link.
- baddox 15y agoFrom a quick scan of the Xtend page, it seems to be fairly backwards compatible with Java source code.
- bunderbunder 15y ago
- siasia 15y agoyet another Scala
- jaaron 15y agoIt's not just Scala, it's Groovy, BeanShell, Factor (JFactor now), Fantom, Frege, Kotlin, Ceylon, Stab, Gosu, Mirah, and that's not counting all the ported versions of Ruby, Python, Lisp (Clojure) and so on. What you haven't written a JVM language yet? It used to be you weren't a proper programmer until you'd gotten fed up and written your own CMS or web framework. Now I guess everyone has to have their own programming language.
- rayiner 15y agoIt's not so surprising. You remove one of the major pain points of developing your own language (platform/libraries), thus reducing the costs of writing your own language, which shifts the industry to a point where there are more languages.
- william42 15y agoSidenote: JFactor is an outdated implementation and I haven't heard anything about it being revived. Factor has compiled to native code for years now.
- nickik 15y agoClojure is not a proted Lisp. Clojure is a new language that is just as diffrent from any other Lisp as Groovy is diffrent from Ruby or Scala from ML.
- Roybatty 15y agoScala has a time to market and a perception problem. Look for Kotlin to be the Scala that Scala never will be.
- foobarbazetc 15y agoI don't know what your beef with Scala is, but you're seriously deluded.
- phzbOx 15y agoSo, "Extend is for the Java Programmer". I'm curious to see how this will turn out as there are some pretty cool features in this language. (Particularly the multiple dispatch, closures and type inference). However, any Java programmers could have made the switch to Clojure or Scala to keep working with the JVM. But, Extend is different in that it generates Java code instead of JVM. So, I'm wondering who will use that. - Java programmers who are still stuck with old version: Even though they'd dream about using this, I'm guessing that won't compile to java 1.4/1.5.. right? - Java programmers who already switched to high level language on top of jvm (Scala, clojure, etc.): Maybe the few who are still with Eclipse would switch back.. but I guess the majority of programmers in this scenario wouldn't want to switch. - Java programmers who refuse, for various reasons, to learn newer languages/tools: Since it's still Java.. and still in Eclipse, it might be easier for them to give it a try? But then, if they refused to switch to newer language, it might be surprising to see them switch to Extend. I'm a bit puzzled (as you can see). Personally, if I have to use the jvm, I'd go with clojure all the way.
- mrgoldenbrown 15y agoScala and Clojure both involve lots of new ways of thinking. This is why I like them. I suspect it is also a reason many hesitate to try or switch to them. People say you can use Scala as basically java with less boilerplate, but if you want to read other people's code, you need to understand a whole lot of new concepts. With Clojure there's no pretending you won't need to learn a bunch of new concepts. With Xtend however, the changes are limited enough that it can be a palatable first step for the hesitant.
- gbelote 15y agoIt may also be a better option for developers who are in less control of their language/platform. Large companies/teams come to mind, who want to avoid individuals using languages unfamiliar to the rest of the group (making it harder for others to maintain). The "compiles to readable java code" may be what convinces someone who would otherwise be against something like Scala. Not saying it's 100% rational, that I agree with the position, or is a large market, but I can imagine it applying to certain groups. There's a certain comfort in knowing that at the end of the day you still have Java code.
- deleted 15y ago[deleted]
- bartonfink 15y agoThis reminds me quite a bit of Groovy, just with a different compiler back end (outputting Java source instead of bytecode). However, this makes me wonder what the point is. Groovy is more-or-less source compatible with Java already (a valid Java program is also a valid Groovy program), so I'm not sure what Extend brings to the table.
- lemming 15y agoIt's statically typed so will presumably be as fast as Java while being nicer to use.
- vorg 15y ago> a valid Java program is also a valid Groovy program), so I'm not sure what Extend brings to the table. Groovy is dynamically typed, not statically typed. Though a month ago Springsource/EMC hired someone to build a static type checker (called Grumpy) for Groovy (http://www.jroller.com/melix/entry/groovy_static_type_checker_status http://www.jroller.com/melix/entry/groovy_static_type_checke...) with the usual solicit for free labor by spinning the "open source" tale. Presumably they heard about Xtend from the same place Jboss/Redhat and Jetbrains did. Hence the recent avalanche of announcements regarding Ceylon, Kotlin, and Grumpy.
- chokma 15y agoA valid Java program is not always a valid Groovy program - see http://groovy.codehaus.org/Differences+from+Java http://groovy.codehaus.org/Differences+from+Java == in Java is identity, in Groovy it is .equals() Inner classes are not supported.
- liquidcool 15y agoI agree, I don't see a reason to switch from Groovy. I don't see the Scala or Clojure people switching, either. But even if you're just trying to convince Java developers, Groovy's ecosystem (including Grails) is hard to beat. And actually, I'm using Groovy++ (http://code.google.com/p/groovypptest/ http://code.google.com/p/groovypptest/), which addresses the concerns about static typing, inference, and performance, all for the cost of an extra jar. It's really surprising how few people - even Groovy programmers - have heard of this. I think it really ought to be included in the core language.
- nyellin 15y agoParenthesis for method invocations are optional, if the method does not take any arguments. obj.compute instead of obj.compute() That seems silly. The optional semicolons also irritate me. ----------------- (Added) I imagine a committee of Java developers, in a penthouse boardroom at Oracle, meeting with management to discuss Java's descent into disuse. "Lets make Java more concise," suggests a senior developer. "Yes! Lets get rid of the parenthesis like Ruby!" "And the semicolons like Javascript." All falls silent. Everyone stares at the programmer. "But... But..." stammers an important board member. "I thought we needed those." "We could make them optional." "Yeah, we'll be multi-paradimatic like Perl!" And so Extend was born. A cargo cult at its best.
- maximusprime 15y agoIt's pandering to hipsters. Parenthesis are just to obvious.
- nolok 15y agoOptional parenthesis if no argument is given was already a feature of at least pascal in the seventies. All those new "cool and innovative" languages are just rediscovering it after almost a decade of everything with C syntax. Not that it's bad or anything, it's just my OCD tingling.
- DanielRibeiro 15y agoWell, Ruby does go beyond this: optional parenthesis with or without arguments. Of course, no public instance variables, like Smalltalk and Scala, makes this possible.
- maximusprime 15y agoIMHO, it's less readable, and more ambiguous. Is it a variable or a function? Who knows!
- eropple 15y ago
- Lewisham 15y agoThis basically looks like Kotlin, except it explicitly compiles down to Java. I'm not sure how I feel about this. Pre-Kotlin, I would have thought "hey, neat", but now it seems like we're on the verge of a number of half-supported half-hearted attempts at being Java.next, each with their own pros and cons. I wish that IDEA and Eclipse could have worked together on this.
- Roybatty 15y agoEven though Kotlin is still essentially vaporware for those outside Jetbrains, we know that it'll have at least decent (if not great) IDE support right off the bat when the alpha/beta is released. I think that Kotlin could be the Java successor that Scala never will be.
- theshadow 15y agoPlease please please baby jesus let me have a dollar every time someone says 'Language X, not language Y is the java successor'
- Roybatty 15y agoThe difference is that we won't have an Emacs/Vim plugin for years and years after it's initial release. Plus, it's not a dynamically typed language and not Scala
- eropple 15y agoIIRC, JetBrains will also be providing an Eclipse plugin (though turning it over to the community after initial dev).
- squidsoup 15y agoIt's a pity everyone gets so worked up over trivial things like parens - Clojure is a beautiful language that absolutely deserves to be the next big language on the JVM. Yes, it offers a different programming paradigm from Java, but perhaps to make any genuine headway in the future we need a clean break from Object Orientation and it's muddled conflation of identity and state.
- m0wfo 15y agoLooks as desperate as pissing yourself to keep warm.
- bitwize 15y agoQuick, list reasons I should use this over Mirah.
- Roybatty 15y agoBecause there's like 3 dudes (maybe a half a dude if you think full-time) that are working on Mirah. Mirah is cool, but from what I've seen Charlie still has to work on JRuby fulltime and there's no IDE support. Jetbrains has pull, and I believe Kotlin will be the language that knocks Java down finally.
- coryfoo 15y agoFirst thing I thought when I read the headline: "Oh boy, half ass Kotlin, here we come". First thing I thought when I saw the website: "Oooh look, Twitter Bootstrap"
- davidhansen 15y agoThis looks to be an also-ran related to the Project Kotlin that JetBrains launched some time ago: http://confluence.jetbrains.net/display/Kotlin/Welcome http://confluence.jetbrains.net/display/Kotlin/Welcome Also: http://news.ycombinator.com/item?id=2784086 http://news.ycombinator.com/item?id=2784086
- rapind 15y agoI wish they'd taken it just a little further and made surrounding brackets optional (using indentation instead). I.e. def greetABunchOfPeople(List<String> people) people.forEach println(sayHello)
- im3w1l 15y agoFurther! greetABunchOfPeople List<String> people pers:people println pers.sayHello
- masklinn 15y agoYou still have a dot in there! greetABunchOfPeople List<String> people people do _ sayHello println
- willurd 15y agoYou left a type in there! greetABunchOfPeople people people do _ sayHello println
- meric 15y agoWhile we're at it, let's switch to haskell (delete the unnecessary people argument): greetABunchOfPeople = mapM_ (putStrLn . sayHello) Explanation: mapM_ is a function that takes two arguments. mapM_ lambda list It calls lambda on each element on list. In the greetABunchOfPeople definition, notice we only gave mapM_ 1 argument instead of 2. That means greetABunchOfPeople would have to take an extra argument for the call to execute. greetABunchOfPeople $MISSING$ = mapM_ (putStrLn . sayHello) $MISSING$
- Periodic 15y agoYou beat me to it. What I love about the Haskell version is it says only exactly what needs to be said. sayHello - get the hello message for something. putStrLn - send something to stdout mapM_ - Do these things in sequence, I don't care about the result. Together they say take a list of people, get their greeting strings and print them to stdout in order. It's hard to say it more succinctly without making things confusingly implicit.
- discreteevent 15y agoCheck out xtext which this is based on. Is even more interesting: Define a grammar and it will generate an editor with code completion etc. For a full programming language (as opposed to a small DSL) its important to be able to "debug at the level of the abstraction" as Dave Thomas (not pragprog Dave) says. This looks like it generates code, so you can't do that.
- mbreese 15y agoYou know that when even Eclipse is coming out with an updated JVM/Java.next language that Java proper has some major issues.
- swombat 15y agoAre you implying that there was still someone on our side of the 50th percentile of programmers who didn't know that?
- eitland 15y agoThe biggest issues are less about syntax and more about having to restart containers etc again and again. But everyone except Play! and a few others seems to be jumping the new syntax bandwagon. Being a php/python/Java developer I'm afraid I'd trade all improvements after generics for a no restart required jvm
- akeefer 15y agoDepending on why you're restarting your VM, you may want to check out the DCEVM: http://java.net/projects/dcevm http://java.net/projects/dcevm It lets you do arbitrary hotswapping of code, rather than only swapping method bodies. Not appropriate for production at this point, but you can install it on top of any Java 6 version prior to update 26 (not sure about Java 7); it's pretty useful for doing rapid iterations during development of large-scale server apps or swing applications.
- ww520 15y agoDoes anyone have the documentation or tutorial for DCEVM? I've looked at it from time to time but never able to figure out how to use it. There's no doc beside the jar file.
- akeefer 15y agoSorry for the late reply (didn't see the question until now). The DCEVM is just a patched version of the JVM dll/so file that allows the normal hotswap mechanism (triggered by JVMTI) to accept arbitrary class changes, rather than just method body changes. There's no additional mechanism or API, it just makes the already-existing mechanism for hotswapping better. To install it, you just run the installer jar and point it to your jdk. To use it, you just trigger a hotswap as you normally would, which generally means starting your program in debug mode via an IDE, and having the IDE automatically swap changes for you as classes change locally. If you want to do hotswapping without the IDE, that's a bit trickier. Technically, you can write your own JNI code to directly hook into JVMTI and trigger a hotswap (which is what we actually do with our development platform at Guidewire), but the easiest way to do it is generally just to use the debug capabilities of the IDE.
- dustingetz 15y agoscala's own evangelists are worried that scala won't overtake java: "...Scala (the language, the tool-chain, the ecosystem, nothing about Scala) is not mature enough to be a Java replacement and barring an order of magnitude or two more investment into Scala commercialization, I don't see Scala becoming a Java replacement"[1]. this is despite seeing twitter and foursquare adopt scala at scale. and Scala's team, Odersky et al, are credible. they've already been through the extend java approach[2]. it didn't work. i see no reason xtend will be any different. [1] http://www.infoq.com/articles/barriers-to-scala-adoption [2] http://www.artima.com/scalazine/articles/origins_of_scala.html anyway, i think the biggest problems with java are lack of first class functions, and no tools to enforce or nudge towards referential transparency. If Xtend helps with this, their page sucks because i skimmed it and i can't tell. verbosity and syntactic sugar seems to be the focus and incremental improvements typically aren't worth the inherent risk of changing pieces of our stack. edit: xtend does seem to have first class functions per below, so my argument is weakened. i'll leave this post for discussion though since its going through some pretty wild vote swings. val predicate = [ Person person | "Hans" == person.name ] persons.filter(predicate)
- weego 15y agoMy understanding is that the primary group of Scala evangelists are aiming for Scala adoption through promotion direct to enterprises as a blanket solution to every market, without any real effort to promote Scala at grass roots or toolchain levels. Correctly some other prominent Scala community members are concerned that this approach can easily lead to high profile failures in Scala adoption and that is a death blow when a language/platform is in infancy and that they should narrow their initial promotion to a few key markets and grow from there.
- maximusprime 15y agoJava has first class functions. They're just called something else and contain a few more characters to create them. I don't understand why some people consider this to be a massive hurdle...
- joelbirchler 15y agothis is stupid
- martiell 15y agoI don't see any mention on how to build outside the IDE (say, on a CI server). Are there Ant tasks? Maven/Tycho integration? These things are important. Where're the docs?
- zackb 15y agoI like seeing the JVM becoming a platform. Even if this particular language looks a bit silly compared to the others.
- gurkendoktor 15y agoOn the new switch statement: > Type guards let you switch (or match) for types, which is much nicer and less errorprone than the usual lengthy instanceof-cascades we write in Java. Ruby can do this too, but it never seemed like a really good idea where I've seen it. The new switch() is better (equals!!), but this particular use case seems so out of place in an OO language like Java. Using «» for interpolation is also a big jump when Eclipse still defaults to MacRoman. (Or have they changed it recently?)
- bartwe 15y agoMy favorite features du jour are missing, generics on value types and structs.
- srik 15y agoGranted Im not the target market, but Implicit returns do not seem like a good idea.
- famousactress 15y agoYeah, is there precedent for that? It looks fucking nutty. Can you do it in the middle of the function!? So odd. There's a lot of cruft in java, but I'm not sure the return statement is even on the list of things I'd bother attacking.
- MichaelGG 15y agoFunctions in mathematics sets a good precedent for lack of a return keyword. Where did you see that it says you can do it in the middle of a function? I understood it implicitly returns the last expression.
- aidenn0 15y agoAs far as a precedent, lisp does it that way, and it may be older than the existence of the return statement. Any language that lacks statements usually does it this way.
- rayiner 15y agoLisp, Dylan, Smalltalk, ML, Haskell, CoffeeScript, and Dart all have various levels of implicit return. It makes sense in a language where there are no statements, just expressions. Generally code is written to not need to return from the middle of a function. This is only really inconvenient in loops, and at least Dylan, Lisp, and Smalltalk make some provision for an "early return."
- Roybatty 15y agoSomeone said Dylan so I just respond...my favorite language of all times :)
- ebiester 15y agoWhile it bothers me that it's Yet Another JVM Language when we have too many anyway, this is exactly what I want from a "blub" language. It adds the syntactic sugar that I care about, but since it compiles to java rather than the JVM, I can actually debug it, and stack traces make sense. It has IDE support. In my personal projects, I love playing with the newest technology. However, when I'm in the enterprise, the point of the language is to communicate effectively to another programmer the intention of the code, because that code will outlive my time at the company. This looks perfect for that purpose.
- rbanffy 15y agoOperator overload would be nice. But I don't think declaring variables whose type can be inferred from the right side of the attribution, semicolons or parentheses for parameterless methods are the biggest problems with Java.
- roestava 15y agoI'm sorry to say, but I think the Go programming language has just been owned by this Extend programming language for Java. Go missed the boat when it did not include some minimum class support to appease the developers used to Java, C++, and so on.
- cmars 15y agoI develop with Eclipse and MDD at my day job, Go in my side projects. I'll definitely evaluate Extend for the day job enterprisey stuff, but in Go, I don't miss the class hierarchy at all; I find it very refreshing.
- roestava 15y agoGo is cool. Go isn't too fast and doesn't have as much tool support as Java/Xtend. Go may be great if you're doing network programming on Linux. Like many tools originating from Unix environments, the cross-platform support may not be a top priority. You're set as you already use Eclipse. :-)
- luriel 15y agoGo's cross-platform portability is quite good, writing portable Go code is infinitely easier than writing portable C or C++ code, and probably as easy or more than Java.
- Sandman 15y agoIsn't comparing Go to Xtend something like comparing apples to oranges? The first one is a language that can be used for low-level development. The other one provides a nicer syntax and some cool features for Java. If anything, it can be compared to Cofeescript which basically does the same thing for Javascript.
- roestava 15y agoIt's not an easy comparison to make, yes. But Go isn't really that low level. It has garbage collector, type inference, unique concurrency support that hides threads... And it's provided on App Engine. App Engine also supports Python and Java. I figure folks could use Xtend to write Java web apps that cut some of the boilerplate and perhaps even deploy to App Engine, for instance. Giving folks an alternative to going with Go as a static typed language. Perhaps Xtend using Java source-code as an intermediate medium confuses people a little. Using Eclipse to program using Xtend/Java may just be too seamless for it not to matter much after you've grown used to it.
- PaulHoule 15y agoHow do I make it work with mvn?
- shareme 15y agookay folks.. Quick explanation.. Its a text based java dsl..so in other words I could develop in xtend an android application model that covers my dev use cases and than have an Eclipse plugin that is for that model.
- spaznode 15y agoHow can we honestly accept anything coming from the people who gave us eclipse? What a giant stinky pile of pooh that turned out to be. I think that the current stewards of the java language are actually going down the most helpful/likely to succeed path to helping fix java by fixing java. What a novel f-ing concept. As much as it can be anyway, and despite the serious reservations of the giant doucheball they inherited with most of oracle. (despite Larry himself possibly being a pretty cool/legit engineer himself)
- hamrickdavid 15y agoGood use of Twitter's css framework, bootstrap. Makes it much easier to launch a website with a decent UI without too much thought.
- Fingel 15y agoI noticed how they literally took the bootstrap front page and changed a few images and the text. Fast indeed. http://twitter.github.com/bootstrap/ http://twitter.github.com/bootstrap/
- itsnotvalid 15y agoI don't know, but, often get irriated by the usage of "closures" when it means "anonymous function/expression". > The term closure is often mistakenly used to mean anonymous function. This is probably because most languages implementing anonymous functions allow them to form closures and programmers are usually introduced to both concepts at the same time. An anonymous function can be seen as a function literal, while a closure is a function value. These are, however, distinct concepts. A closure retains a reference to the environment at the time it was created (for example, to the current value of a local variable in the enclosing scope) while a generic anonymous function need not do this.
- ScottBurson 15y agoAgreed. As I've written here previously: http://news.ycombinator.com/item?id=2303548 http://news.ycombinator.com/item?id=2303548 A longer explanation: http://news.ycombinator.com/item?id=2851446 http://news.ycombinator.com/item?id=2851446
- groovy2shoes 15y agoYou don't have to assume that they actually mean anonymous functions. There's no real reason why the Xtend compiler couldn't translate closures to Java objects.
- itsnotvalid 15y agoBut by closure I usually refer to the definition of some Lisp books: >> a closure is a collection of closed-over variables retained by a function. I don't really dig deep for what the constructs would produce in memory, but they should be some lambda expression.
- rshm 15y agoDoes this remind anyone of Borland era ? At least for now it is an editor centered solution.
- ypcxz 15y agohahaha - too late. Node.js for the win.
- deleted 15y ago[deleted]
- mrerrormessage 15y agoyou can dress up a pig...
- sreque 15y agoI'm pretty disappointed in the discussion that has gone here. There's been so much argument over things that don't matter much in the end, like whether or not optional semicolons and parenthesis are a good thing. These things are so superficial! It makes me believe that few people appreciate what actually makes a language good or bad. The fact that Xtend can be easily translated to Java source code is a big sign that it probably won't have any dramatic impact on your productivity. I think the comparison that has been made between Xtend and Coffeescript is most accurate. Xtend will likely be more pleasant to work in than Java, but it won't be a game changer in terms of what you can accomplish with it. Still many people are happy with Coffeescript, and if Xtend does thing right many people might be happy with it as well. And, I'm pretty sure David Pollak is the only Scala evangelist who is worried Scala won't or shouldn't overtake Java. Everyone else seems to be committed to making Scala a better and better out-of-the-box experience, and there continues to be initiatives and commercial investment in improving things like IDE support, documentation, coding standards, training opportunities, and more.
- buff-a 15y agoThe fact that Xtend can be easily translated to Java source code is a big sign that it probably won't have any dramatic impact on your productivity I do not believe that there is any evidence for this statement. Translating ARM assembly language into opcodes is orders of magnitudes easier than translating Xtend into Java, yet I would argue that even that had a dramatic impact on my productivity back when I was doing such things. If Xtend introduces proper closures just that right there will improve productivity. However, if I were to accept your premise that easy translation implies little value added, then I would have to point out how wonderful it is that we live in a time where we regard writing a parser for a language like Xtend and the requisite bits of goo to spit out java is considered "easy".
- sreque 15y agoThe evidence for this statement best comes from a research paper* that attempts to formalize language expressibility . According to their formalization, language features are classified as macro expressible if they can be implemented in terms of local syntax transformations of other language features. The paper shows that expressivity, power, and conciseness come the most from those features that are not macro expressible. Yet, none of Xtends features seem to be in that category. Since most languages don't have macros or compiler plugin frameworks, there can still be great value in adding macro expressible features, but, as I said in my previous post, these are less likely to be game changers in terms of productivity. These are the kinds of features that IDEs can make up for with templates and code generators. As an example, an anonymous class might be bulky, but it essentially provides the same feature set as a closure and the IDE is good at writing most of the boilerplate for you. *see www.ccs.neu.edu/scheme/pubs/scp91-felleisen.ps.gz
- LeafStorm 15y agoAs far as I can tell it's only shipped as an Eclipse plugin. Are there any plans for a standalone Xtend compiler that doesn't depend on Eclipse?
- 6ren 15y ago"multi-line string literals" are very useful, because they enable you to create DSLs that are easy to use. As in the example, you can have HTML; or XML; or make up any language you want. Of course, it doesn't help you implement it (you'll have to parse the string yourself); but it makes it usable. A downside is that it makes that code hard to understand for developers unfamiliar with the specific DSL.
- linuxhansl 15y agoMeh. I don't understand what is so bad about Java. Yes, there's boilerplate, which can addressed with the right development tools. New languages are a good thing. But a language whose sole purpose is to remove boilerplate from Java, does not really get us anywhere.
- dextorious 15y agoIf you have to program in the Java ecosystem, not only "a language whose sole purpose is to remove boilerplate from Java" helps you tons, but it gets you to a lot of places.
- moss 15y agoMuch of the time, I'd agree. But working on a large system in Java, I repeatedly see a few places where Java's boilerplate overwhelms the code I actually care about. Operations on collections: List<String> result = new ArrayList<String>(); for (String word : words) { result.add(word.toUpperCase()); } return result; Accessor methods: private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } And arithmetic on user-defined types: new Dollars(15).plus(new Dollars(25)).times(new Percentage(80)) This bulky, uninformative, junk code is a real barrier to readability, and these are just simple examples. Sure, it's possible to work around it, and to keep the badness contained, but it still means time wasted for anyone who needs to maintain it. We started writing some code in Groovy on our large Java project at work a few months back, and it's been a revelation. Groovy feels like a bit of a hack in all kinds of ways, but we're still delighted with it, because being able to say: return words.collect { word -> word.toUpperCase() } or: String name or: (new Dollars(15) + new Dollars(25)) * new Percentage(80) just makes it _so much easier_ to see what's going on at a glance. Maybe if I were on a different sort of project -- one where I spent less time maintaining old code, or working with collections of data -- reducing boilerplate would seem like less of a big deal. As it is, though, it has seriously improved my quality of life. If Xtend can bring that kind of improvement to more people, I'm all for it.
- linuxhansl 15y agoWith a bit of code: public interface Functor<T> { T apply(T v); } public class Util { public static <T> List<T> collect(List<T> l, Functor<T> f) { List<T> result = new ArrayList<T>(); for (T v : l) { result.add(f.apply(v)); } return result; } } You can write: List<String> l = ...; Util.collect(l, new Functor<String>() {public String apply(String v) {return v.toUpperCase();}}); Not as concise, but not that horrible either. :) I never quite liked operator overloading, because of infix notation all operators need to retain their precedence.
- devs1010 15y agoEclipse is painful to use, just switching to using IntelliJ Idea IDE I have felt a lot more productive. I still have to use both since my company's "official" IDE is Eclipse and if I'm working on a problem where another developer might be looking at something with me I have to use it or they'll get really uncomfortable. The auto-completion in IntelliJ and better responsiveness of the UI make it a much better expiernece IMO. I really think one of the main problems with Java IS Eclipse, if more Java dev's used a better IDE I can't help but wonder if things like this wouldn't be thought of as being as necessary
- random42 15y agoI _just_ started on Java on eclipse, after 4 years of _IDE-less_ coding in python. Care to tell me what you find better in IntelliJ, as compared to eclipse, so that I dont waste a lot of my time with Eclipse? :-)
- moss 15y ago* There are memorable keyboard shortcuts for everything. * It can generate comparatively more code for you. * It's faster, though I fear it's working on losing this advantage. * The autocomplete is smarter, and has a few different options. I started using IntelliJ a few years ago, when I came onto a Java project after several years using vim and Python, and I'm convinced it made the transition a lot less painful. The difference between IntelliJ and Eclipse may be smaller than it feels to me now--IntelliJ is what I'm used to, after all, so using Eclipse involves adjusting to a subtly different interface--but I'd still say it's worth a try. There's a free version, so there's not really anything to lose.
- devs1010 15y agoEclipse crashes on me or freezes up frequently despite using a quad-core brand-new laptop with 8gb memory. The UI frequently becomes unresponsive. Anything to do with IO such as opening files, having maven pull in a bunch of files, etc is horribly slow and usually causes the app to freeze. As far as I know it doesn't offer variable suggestion, in IntelliJ you just type the first letter or 2 and it immediately suggests any variables you have in scope, I find this invaluable as it really speeds up writing code sometimes. Overall, I find it simpler whereas Eclipse is just kind of a free-for all where you need to make use of a patchwork of plugins to be successful. IntelliJ is written by one company so I just always get the feeling it has a better "engine" underneath it. Half the developers on my team curse Eclipse and say they hate it but none have switched to using another IDE except me, the others are too set in their ways, I get the feeling its firmly embedded amongst a certain generation of Java dev's but if you're just starting out (I'm also pretty young relatively speaking) I'd recommend considering using another IDE.
- Roybatty 15y agoScala had its chance, and it didn't work...no matter what Martin and his boys, and his minions want. Kotlin will take over Java. That is fact. Mark my words on 11/05/2011.
- SWengineer 15y agoYou've repeated those sentiments up and down this thread. Personally I don't see much difference between the two, even syntactically. I've seen scala starting to get a foothold at my organisation, but haven't heard of anyone discussing Kotlin. What is also interesting is doing a trends search for scala jobs at indeed.com It looks like Scala has started to get a small but very rapidly growing slice of the job market
- vilya 15y agoThere's an assumption that compiling to Java source will make this easy for Java developers to transition to, which I believe is completely misguided. If you edit the generated java source you give up the ability to use Xtend at that point; if you don't then it's no different to using a language which compiles directly to jvm bytecodes. Their example of being able to debug through the generated java sounds like a drawback to me: you have to maintain two models of the program in your head instead of one. Much easier to debug through the original source! I applaud any effort to cut down on the amount of boilerplate required in java though.
- Sandman 15y agoI'm actually kind of worried about what the generated Java code will look like. From what I can see from the greeter example, it's.. well, not very pretty. It certainly looks nothing like what one would normally write if one was writing pure Java code. Imagine having to maintain that.
- ramblerman 15y agoI 'm pretty sure you would maintain the extend code. Otherwise your doing it wrong :P
- Sandman 15y agoIn that case, what's the use of compiling to java source code, why not compile directly to bytecode?
- snorkel 15y ago(5 years from today) Extend is too low level ... I think we need another meta language on top of it.
- ramblerman 15y agowhat's wrong with that?
- nickand 15y agoExactly. It would be nice if someday someone realized a language shouldn't be constantly trying to teach the programmer something about computers. The best language would do as much of the work as possible by having a default for everything and by assuming as much as can be assumed. The point is not to reaffirm over and over what a variable is and how it is stored. We should learn that once in a text book and then get some work done. If you are designing programming languages for a living then maybe you should be concerned with that. This is called division of labor.
- perfunctory 15y agoBuilding a language on top of java is a deadend.
- longpants2 15y agoI tried out Xtend, but got stuck on a deal killer: no apparent support for defining static fields or methods. http://longpants2.posterous.com/first-experience-with-eclipses-java-killer-xt http://longpants2.posterous.com/first-experience-with-eclips...
- limmeau 15y agoWhen I read the title, I hoped they had built a replacement for the tedious XML declaration of plug-ins, with Commands and Workbench Core Expressions and all that. (Example: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_cmd_expressions.htm http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclips... ) Am I right that Eclipse Xtend is just not targeted towards extending Eclipse at all, despite the name?
- mkramlich 15y agoDoes not look impressive to a Pythonista. yawn
- mike_ivanov 15y ago> compiles to readable Java code [insert your favorite Ratfor joke here]
- ehynds 15y agoNo one else is upset about the HTML 2.0 doctype on the examples page? WHERE IS THE OUTRAGE? http://www.eclipse.org/Xtext/xtend/#templateexpression http://www.eclipse.org/Xtext/xtend/#templateexpression
- Yeroc 15y agoI'm surprised there's been no mention of Lombok (http://projectlombok.org/ http://projectlombok.org/) since the goals seem to be the same. Lombok of course, is not a language but just a set of annotions and annotation processors to handle the code generation behind the scenes. Will have to look at this more closely to see how the two compare...
- sjwright 15y agoAccording to that page, their new switch expression is very egelent.
- nickand 15y agoThe reason I never used Java is that every time I tried to learn it I would get type errors. So in order for my programs to work I needed to constantly define what type things were. The other big problem I had was whenever I tried to follow examples they didn't work because there is an arcane system of importing libraries or knowing some long function name. The language doesn't seem to have any universal functions. You have to import everything. If this changes any of that then I might use it. I really like the idea of programs being able to run on any operating system. Oh one more thing is the eclipse IDE seems to have so many different set ups and ways to download it how can you know which is the right one?
- Sandman 15y ago1. Java is a statically typed language so yes, the types need to be defined and known at compile time. Some people like static typing, others not so much. If you fall into the second group, there's a whole lot of dinamically typed languages you can try out. 2. Java is also object-oriented. This means that, in java, all the functions are methods of objects. There are no 'universal' functions which are not attached to objects in any way. Again, some people think that the object-oriented approach is a good thing which more accurately describes the world we live in, and some don't [1]. It's up to you to decide whether you think OO is a good or a bad thing. 3. Regarding Eclipse.. Go to http://eclipse.org/downloads/ http://eclipse.org/downloads/, choose the installation which suits you best (if you're going to do some standard java development, then obviously you'll choose the first installation, 'Eclipse IDE for Java developers'). If you later wish to develop for other languages (or write enterprise java apps), no problem, Eclipse is very extensible so you can always include the appropriate plugin in your current Eclipse installation. [1] http://www.google.com/search?q=object-oriented+programming+sucks http://www.google.com/search?q=object-oriented+programming+s...