Live data from Hacker News

Eclipse launches new language to cut down Java boilerplate - Extend

eclipse.org

221–229 of 229 posts

Re: Eclipse launches new language to cut down Java boilerplate - Extend

#221
post #82
post #46

Earlier quoted context omitted.

Depending on why you're restarting your VM, you may want to check out the 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…

Does 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.

Sorry 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.

Re: Eclipse launches new language to cut down Java boilerplate - Extend

#222
post #195

Meh. 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.

Much 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 result = new ArrayList (); 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) { thi…

With a bit of code:

  public interface Functor {
    T apply(T v);
  }

  public class Util {
    public static  List collect(List l, Functor f) {
      List result = new ArrayList();
      for (T v : l) {
        result.add(f.apply(v));
      }
      return result;
    }
  }
You can write:

  List l = ...;
  Util.collect(l, new Functor() {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.

Re: Eclipse launches new language to cut down Java boilerplate - Extend

#223

Earlier quoted context omitted.

At least then vim would understand it and you wouldn't have to deindent every 'end' yourself. It would be nice to be able to use % and some other stuff that you get with most other languages. The fact is that the visual style of a language is trivial to get used to. Breaking my text editor is a real issue though.

vim does understand Ruby. As soon as I type end, it automatically de-indents the line 2 spaces. Put this in your ~/.vimrc: filetype plugin indent on

also matchit.vim to do %-bouncing between keyword/end pairs

Re: Eclipse launches new language to cut down Java boilerplate - Extend

#224

Meh. 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.

think of extend as one of the development tools, then

Re: Eclipse launches new language to cut down Java boilerplate - Extend

#225
post #178

Earlier quoted context omitted.

Actually, I really am sure Clojure will fit in all of those problem domains. Indeed, I'm pretty sure that if you experienced a well-written Clojure accounting app, you'd wonder why people bothered with Java.

Would like to see the code if you have the example. Would be a very interesting case-study as to why Functional fits such problem domain as opposed to OOP because this would open a new perspective. Please share more. I'm interested. (Let me know if you can only share your experience via private channels).

Sadly, I can't share any code, but here's my basic observations: First, calling a standard Java object from Clojure is extremely painless. It's a bit more complex if you're dealing with listeners, but in general terms a java object is a java object without very much getting in the way. This means that all of your favourite GUI libraries are usable without modification.

Second, as Carl pointed out, Clojure does have state, it's just tightly controlled. So tightly controlled that multi-threaded programming is much easier. There's some things that I'd like on top of what it does, but it's very powerful and useful.

Thirdly, I'm not denying that thinking functionally takes a while, but as you develop the skill, it's amazing how many things actually look pretty stateless. I've met actuaries who use F# for all of their calculations. Equally, converting game state to a 3d scene graph is a pretty stateless process (although I've yet to meet anyone who's actually getting paid to do functional game programming).

Hope that is interesting. Will be glad to share more.

Re: Eclipse launches new language to cut down Java boilerplate - Extend

#226
post #85

Earlier quoted context omitted.

Sorry for not understanding, but can you explain what the ambiguity is here?

A C-like parser will keep parsing an expression as long as it's legal. Take: foo("bar") * a It will parse the call to 'foo', then see the '*' which is an infix operator and parse the whole thing as a multiplication expression. In most C-like languages, '(' is both a prefix operator (for grouping) and an infix operator (for function calls). So: foo("bar") (a + b) Is ambiguous if you don't require semicolons to separat…

Wow, yes of course. For some reason I thought Xtend was whitespace sensitive, so just having a newline was enough.

Re: Eclipse launches new language to cut down Java boilerplate - Extend

#227

I 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, whil…

You 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.

But 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.

Re: Eclipse launches new language to cut down Java boilerplate - Extend

#228
post #184

Earlier quoted context omitted.

> 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. It appears to be common Hackernewserthink that "productivity" equals "the ability to write code as fast as possible". Beyond the first few weeks of coding, you'll spend much more time reading code and refactoring it. What Xtend offers is an object model and type system…

> It appears to be common Hackernewserthink that "productivity" equals "the ability to write code as fast as possible". Beyond the first few weeks of coding, you'll spend much more time reading code and refactoring it. And even more time thinking . This is one of the reasons I never understood the obsession many people have with vim/emacs/whatever shortcuts and the like, for me they are distractions from what is real…

Having typed since I was 5, I think while typing, and going back and forth in code is the same as thinking for me. I'd expect that most of these amazing hackers are from the era where they wouldn't see a keyboard until being 16 or 18.

I'm not a vim/emacs shortcut freak, but I do appreciate environments that don't make me use a mouse.

Re: Eclipse launches new language to cut down Java boilerplate - Extend

#229
post #111
post #108

I'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…

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 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…

Another issue is that UI tools like WindowBuilder Pro won't work well with the generated Java code which will likely end up getting overwritten by the Xtend builder. Mmm. But it wouldn't have worked anyway without the conversion!
Post reply on HN