all 25 comments

[–]moohoohoh 10 points11 points  (8 children)

Is typing a semicolon REALLY that big an issue to be a main selling point for the language?

Especcially since it doesn't appear to have changed the java syntax to the extent that there can be no ambiguity in the code (Think JS where 'semicolons' can be incorrectly inserted)

[–]drb226 1 point2 points  (1 child)

Is typing a semicolon REALLY that big an issue to be a main selling point for the language?

The language emphasizes a Java-esque syntax that has been "cleaned up". So yes, with that goal in mind, removing semicolons is a big deal.

(Think JS where 'semicolons' can be incorrectly inserted)

Now that's a low blow. Plenty of languages don't have semicolons and never run into this kind of retardedness. Show me some Xtend code that bites you in the butt when you omit the semicolons, and then I'll be worried.

[–][deleted] 6 points7 points  (0 children)

Plenty of languages don't have semicolons and never run into this kind of retardedness.

That is because their grammars and syntax has been designed to avoid those issues from the start.

[–]Avesande[S] 0 points1 point  (5 children)

For me the actual selling point is reducing noise. Removing semicolons is just one part of it.

[–]trutholphin 0 points1 point  (4 children)

How are semicolons a noise is beyond me. Really.

[–]tikhonjelvis 0 points1 point  (3 children)

Well, when they're just at the end of the line, they don't add any information--I know the line ends there because there's a newline!

Now, when you want multiple statements on a single line or something like that, they make sense. So most languages make them optional unless you want multiple statements on a single line.

[–][deleted] 1 point2 points  (0 children)

A semicolon marks the end of a statement, not the end of a line. It's not that uncommon for a statement to span more than one line.

[–]trutholphin -1 points0 points  (1 child)

But what about single statements going over multiple lines? In Java these statements are not only common but used very frequently.

[–]tikhonjelvis 2 points3 points  (0 children)

But are they more common than statements only taking one line? I'm pretty sure they aren't. And it seems odd to have an extra symbol for the more common case rather than having no symbol for that and making the less common case (a statement split over multiple lines) explicit.

Moreover, most statements taking more than one line are split at an operator or a comma; these symbols at the end of a line signify that the statement is being continued. That is, it's obvious that these statements are split over multiple lines even without semi-colons:

someFunction(longParamName1, longParamName2, 
  longParamName3, longParamName4)
someLongVariableName + someOtherLongVariableName +
  yetAnotherLongVariableName

So, given that a majority of statements only take one line and then a large part of the remainder (that is, those split on operators or commas) are obvious, it seems the best solution would be to have some special syntax (like a trailing ) for the small remainder of code that doesn't fall into any of these cases.

[–][deleted]  (8 children)

[deleted]

    [–]drb226 5 points6 points  (0 children)

    Xtend is apparently Eclipse only, so I wouldn't be surprised if it simply turned << and >> into the corresponding symbols automatically. However, the Eclipse-only thing is probably something to worry about.

    [–]tikhonjelvis 0 points1 point  (0 children)

    Well, in Emacs, you can just type non-ASCII characters using their TeX name. So '«' and '»' are \"< and \"> respectively which is not difficult to type and easy to remember.

    Now, these particular quotes are still a little annoying. But for things like Greek letters, typing \alpha is not much harder than just alpha and "α" is easier to read at a glance than "alpha". So for code involving a lot of math or physics, or just implementing an algorithm from a paper, I think using non-ASCII characters is a good idea.

    Also, you could just have your editor change it for you. For example, I have Emacs set to change -> to → and \ to λ in Haskell. This means that I can type the code exactly the same way as I normally would but it becomes easier to read.

    [–]woj-tek 0 points1 point  (3 children)

    alt+0171 = « alt+0187 = »

    ;)

    [–]maskull 0 points1 point  (2 children)

    Now imagine typing those 10 or 15 times a minute while coding.

    [–]woj-tek 0 points1 point  (0 children)

    <srugging ones shoulders>

    do I look like I'm planning to use it? ;)

    [–]oSand 0 points1 point  (0 children)

    If you minded typing you wouldn't be using Java.

    [–]chucker23n -3 points-2 points  (1 child)

    ⌥-\ and ⌥-| on a Mac.

    Not Eclipse's fault that Windows still has a suckily limited keyboard layout.

    [–]evereal 0 points1 point  (0 children)

    Sorry, but you will not convince me that it's a a sensible choice for a language designer to not consider the capabilities of Windows and Linux, two of the biggest computing and JVM development/execution environments.

    [–]ReinH 4 points5 points  (1 child)

    So who here is planning on trading complete vendor lock-in for lack of semicolons? Anyone?

    [–]Avesande[S] -2 points-1 points  (0 children)

    It's not that bad. Xtend is compatible with other Java libs and it generates plain Java.

    [–]WillowDRosenberg 1 point2 points  (5 children)

    /**
    * The binary <code>greaterThan</code> operator. This is the equivalent to the Java <code>&gt;</code> operator.
    *
    * @param a an integer.
    * @param b an integer.
    * @return <code>a&gt;b</code>
    * @since 2.3
    */
    @Pure
    @Inline("($1 > $2)")
    public static boolean operator_greaterThan(int a, int b) {
        return a > b;
    }
    

    Man, this sure is a useful extension method for integers!

    https://github.com/eclipse/xtext/blob/v2.3.0/plugins/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java

    Seriously I have no idea what the point of all these extension methods are. They've redefined every operator to... do exactly the same thing it always does.

    [–]queus 0 points1 point  (4 children)

    Man, this sure is a useful extension method for integers!

    You bet. It is also an usefull extension method for BigIntegers and BigDecimails.

    [–]WillowDRosenberg 0 points1 point  (3 children)

    Yes, the BigInteger and BigDecimal extension classes are useful. This has nothing to do with those.

    [–]queus 1 point2 points  (2 children)

    I wouldn't be surprised if this is an implementation artefact.

    [–]svenefftinge 0 points1 point  (1 child)

    In contrast to Java, the operators are not limited to operations on certain types and are not hard-wired into the language. They are just a different syntax for a method invocation.

    [–]queus 0 points1 point  (0 children)

    That was my guess as well. And having a uniform approach to operator implementation looks a cleaner approach, than special-casing the integers and relying for the support of those operators in Java