Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming Java Open Source

Gosu Programming Language Released To Public 330

llamafirst writes "Guidewire Software released the Gosu programming language for public availability. Gosu is a general-purpose programming language built on top of the Java Virtual Machine (JVM). It is object-oriented, static typed, imperative, and 100% Java compatible (use/extend Java types, implement Java interfaces, compile to Java bytecode). It has type inference (very readable code yet static typing!), in-line functions that you can pass as objects (closures / lambda expressions / blocks), enhancements (inject methods + properties, even on Java types!), and simplified generics. Gosu is provided via the Apache License v2.0. The language itself is not yet open source, although that is planned for a future community release. You can read a complete introduction to the Gosu language, a comparison to other languages, and syntax differences from Java."
This discussion has been archived. No new comments can be posted.

Gosu Programming Language Released To Public

Comments Filter:
  • Sounds like Scala (Score:3, Insightful)

    by NightWhistler ( 542034 ) <alex.nightwhistler@net> on Tuesday November 09, 2010 @03:13AM (#34170834) Homepage

    From a quick glance it looks like Scala with a more Java-like syntax... I wonder what added benefit they hope to bring.

    I'd be very interested to see an in-depth comparison of the two.

    • Re:Sounds like Scala (Score:4, Informative)

      by NightWhistler ( 542034 ) <alex.nightwhistler@net> on Tuesday November 09, 2010 @03:17AM (#34170848) Homepage

      OK, replying to myself because I obviously didn't have enough coffee yet:

      They list as the benefits over Scala
        - Extensible type system
        - Easy transition from Java
        - Reified Generics

      From those 3 points, only the last one sounds useful...

      • I haven't read the docs yet, but how can they claim reified generics and full Java compatibility?

      • by Chrisq ( 894406 )

        OK, replying to myself because I obviously didn't have enough coffee yet:

        They list as the benefits over Scala - Extensible type system - Easy transition from Java - Reified Generics

        From those 3 points, only the last one sounds useful...

        Except that reified generics are available in Scala using manifests [scala-blogs.org]. I am not sure what the "extensible type system" means but there are various ways of adding to a type system in Scala. However I agree on not being an "Easy transition from Java". Scala is not really an easy transition from anything!

      • I disagree (Score:3, Insightful)

        OK, replying to myself because I obviously didn't have enough coffee yet:

        They list as the benefits over Scala - Extensible type system - Easy transition from Java - Reified Generics

        From those 3 points, only the last one sounds useful...

        You are kidding right? In reality-land, for better or worse, #2 is probably as important of all for a lot of Java shops as #3 if not more. Type erasure sucks balls, but we can get it to work (just as we were able to write good working code without generics.)

        Adoption and ease of transition are things people tend to undervalue/underestimate. Being able to leverage a language with better qualities with as little code change as possible is certainly an enormous, practical incentive. For me, I would give an ey

    • by DrXym ( 126579 )
      From a quick glance it looks like Scala with a more Java-like syntax... I wonder what added benefit they hope to bring.

      Well if it were a superset of Java then the answer to that should be obvious. I sense people are getting seriously fed up with Oracle / Sun's glacial development schedule as well as all the legal shenanigans. Java 7 is the Duke Nuke Em of language iterations. If someone produces a Java with extensions (almost like C++ was C with classes originally) then they might jumpstart development a

    • My understanding is that the syntax changes were one of Gosu motivations. The changes were all in the direction to make the language more "easy to read". It almost got some pythonic aura in a sense
  • Another Language (Score:4, Insightful)

    by phantomfive ( 622387 ) on Tuesday November 09, 2010 @03:42AM (#34170946) Journal
    At one time in my programming life I liked learning languages, I made it my goal to learn pretty near every interesting language from APL to FORTH.

    Then one day I woke up and realized, it isn't the language, you can write good or bad code in any language. It's how you use the language, and how you organize the code that matters most. I realized as long as you have the ability to encapsulate, you can write good code in any language, even in assembly.

    In fact, with a good macro library, I can write code just as fast and well in assembly as in any other language.

    Or, on the other hand, maybe I've fallen into the trap represented by this saying, "The determined real programmer can write Fortran in any language." But I don't think so. :)
    • As long as you're not writing GW-Basic or COBOL in any language, I think you're not too far gone.

    • by Anonymous Coward on Tuesday November 09, 2010 @04:08AM (#34171064)

      Perhaps it is tempting to see only encapsulation as the sine qua non in programming languages. However, a programming language does not merely make an algorithm machine readable, but also human readable (eg. yourself after 2 weeks). Therefor, the following properties are important:

      - Conciseness: eg. Haskell is more suitable in representing certain algorithms, as part of the interpretter/compiler makes 'good' choices, you'd have to specify otherwise. The same goes for languages such as Prolog.
      - Manipulatibility: to change a certain aspect of an algorithm (or of a whole system), we need a representation of this aspect. Aspect Oriented Programming, Lambda expressions and meta-object oriented programming are examples of this.
      - Suitability to domain: whether a mathematician or a business process manager reads your code matters. Their experience and expectations differ.
      - lots more...

      Yes, all of it is reducable to a Turing Machine, but languages matter. A lot.

      • Re: (Score:3, Insightful)

        by phantomfive ( 622387 )
        Indeed, those do matter.

        My point is, if you give me sufficient encapsulation tools, I can write code that is concise, readable and manipulable. And it is something anyone can do.
    • by OneSmartFellow ( 716217 ) on Tuesday November 09, 2010 @04:17AM (#34171106)
      it isn't the language, you can write good or bad code in any language

      But, VB makes writing bad code trivial, and writing good code challenging.
      • by Chrisq ( 894406 )

        it isn't the language, you can write good or bad code in any language But, VB makes writing bad code trivial, and writing good code challenging.

        COBOL even more so

      • by kaffiene ( 38781 ) on Tuesday November 09, 2010 @05:36AM (#34171440)

        Exactly. Which is why this "all languages are equivalent" mantra is just so much bullshit. All languages have domains for which they are more or less suited.

        I don't do script-like tasks in assembler, I don't do device drivers in Java, I don't write enterprise apps in Javascript or VB. Neither do most sane software engineers. This isn't a coincidence, it's because certain tools are better at certain jobs. People who argue that it doesn't matter what language you use cannot explain why good software engineers know why some languages are inappropriate for some jobs.

        • Re: (Score:3, Insightful)

          by obarthelemy ( 160321 )

          Hey, I'm gonna try for an analogy that is neither cars nor pizzas. Let the mod points roll !

          Languages are like MP3 players: some have strong points, extra features, nice ergonomics better price.. but in the end, what counts is the Apple-like ecosystems: users, developpers, tools, PR, content...

          Judging a language on its own merits is nice and all, but in the end, wuality of the tool sets, docs, hype... are probably a bigger contributing factor.

      • VB is not a language! ;-)
    • Re: (Score:3, Insightful)

      by SharpFang ( 651121 )

      ORG 0000h
      LCALL MACROLIB #initialize the macro library
      #from now on, let's write some macros we have just defined.
      class HelloWorld {
      public static void main(String[] args)
      {
      System.out.println("Hello World!");
      }
      }
      LCALL EXECUTE
      JMP $

    • by boorack ( 1345877 ) on Tuesday November 09, 2010 @06:44AM (#34171682)
      Granted that not only you learn a language but also grasp philosophies/patterns/paradigms/etc. behind it, it's a Good Thing (TM) to learn new languages on regular basis. You need, however, learn much more than mere language.

      It's good to learn some assembly languages to see how machines work.

      It's good to learn C to get accustomed with low level things, pointer arithmetic, in-memory layout of code & data, OS internals and tons of other things. It's good to tinker and experiment with high performance C code, see how functions look disassembled. Try adding two matrixes row by row and then column by column and see performance differences etc.

      It's good to learn C++ to get accustomed with it's metaprogramming facilities, learn how to implement semi-automatic memory management via smart pointers and how all these high level things interact with low level.

      It's good to learn Java to get accustomed with that whole big world of objects, OOP patterns, TDD, exception handling strategies and tons of other things.

      It's good to learn Scala to get smooth introduction into functional programming concepts (higher level functions, closures etc.) and see how it can be incorporated into traditional object oriented code and more interesting concurrency models (actor model for example).

      It's good to learn Erlang to grasp functional programming even more, learn how to effectively use pattern matching, see the THE actor model implementation and learn about it's interesting error handling philosophy.

      It's good to learn LISP to grasp it's macro system that still cannot be matched in any other language. See Common Lisp at work and Clojure for it's approach to parallelism, mutability and distinction between values and identities.

      It's good to learn Haskell to see how to program in purely functional way and see monads in action.

      Not that I'm in any way competent in all things above. Much of it (plus other things) is still on my TODO list. I'm still being surprised by new ideas showing blind spots of my ignorance on regular basis. I don't buy however that learning new languages doesn't matter anymore. It matters. It's important. Maybe we should choose new languages to learn more carefully, choose less but dig deeper.

    • by icebraining ( 1313345 ) on Tuesday November 09, 2010 @06:48AM (#34171710) Homepage

      How many lines do you need to emulate a Python's list comprehension statement in assembly? Even if you encapsulate, assembly simply doesn't let you express everything in the statement without a massive number of LOCs.

      Higher level languages are more readable for higher level concepts. It's not the same.

    • But then again I think of it as a bit like wine-tasting. Tasting as many langauges as possible gives me the ability to identify what goes best with what, how do I know if a task is more suited to Perl than assembler - only because I have used both. That said there has to be limits, if I have been using Java exclusively for a few months, it may be a lot quicker for me do some data mangling in Java even though it may require 10x as many lines of code the equivalent Perl (simply because I'll have to switch my

  • Its new age cobol. I can hear the PHB now. If we use and instead of && our secretary will understand how to code and we'll save milions!

  • it seems some very nice aspects of Java, Pascal, C# and Basic combined, with both compiler and runtime library problems elegantly solved.. This looks really good to me. And I am not big fan of new languages.
  • Yuck!!! (Score:2, Interesting)

    by gustgr ( 695173 )

    Phonetically gosu sounds identical to the Portuguese word "gozo", which literally means cum (as in ejaculation).

    • Only in Brazil. It has no such connotation in Portugal.

      • Re: (Score:2, Interesting)

        by gustgr ( 695173 )

        Interesting to know. Originally it was used in the same way as it is used in Spanish, meaning joy or pleasure (when a noun). In Brazilian Portuguese it has acquired the sexual connotation besides the usual meanings. Funny thing is that I just discovered that gozo means sweet in Basque.

  • by shutdown -p now ( 807394 ) on Tuesday November 09, 2010 @04:29AM (#34171164) Journal

    The introduction has this gem:

    Gosu supports a simplified version of generics. Generics are a way to abstract the behavior of a class to work with different types of objects, but to still retain type safety. There are no wildcards, and generic types are covariant, like Java arrays, which is usually what you want.

    And here's how to make the type system bite the dust with this flaw:

    uses java.util.*;
    var xs : List<Object> = null;
    var ys = new ArrayList<String>();
    xs = ys; // type system allows this blatant LSP violation
    xs.add(123); // we just added an integer to a list of strings - great
    print(xs.get(0)); // yeah, this prints 123 - just to be sure
    ys.get(0).length(); // finally, a ClassCastException which should've happened 3 lines earlier

    What's funny is that Eiffel has already fallen into the very same trap [loria.fr], and is still trying to dig itself out of it [eiffel.com].

    • The really funny thing is that in practice all generics really need to do is prevent you from having to repeat casts everywhere, catch errors moderately soon, and aid in documentation. Which is what these do. The real 'trap' here is thinking that something has to be theoretically perfect to be useful or convenient.

      • by shutdown -p now ( 807394 ) on Tuesday November 09, 2010 @04:58AM (#34171294) Journal

        The really funny thing is that in practice all generics really need to do is prevent you from having to repeat casts everywhere, catch errors moderately soon, and aid in documentation. Which is what these do.

        They don't let you "catch errors moderately soon" in many real scenarios. It's the same problem as implicit null value for reference types everywhere - end result is you can have one part of code returning null where it shouldn't, that null get quietly propagated throughout your system from component to component because no-one needs to do anything to it, and then it all finally blows up when some other code elsewhere receives a value that should not be null but is - and you end up with a NullPointerException and, often, no clue as to what code originally produced the invalid value.

        Same thing here - someone, somewhere will create a collection of subtype, implicitly upcast it to supertype, and pass it over because they do not understand that List<Number> cannot always be substituted for any random List<Object> - because it's non-intuitive, despite being true (since add() is not covariant). All the evidence I need for this are all the questions asking about how to do just that in Java or C# on StackOverflow. When you ask people to post the code, it almost invariably turns out to be broken, and the type system did them a favor by rejecting it.

        The real 'trap' here is thinking that something has to be theoretically perfect to be useful or convenient.

        We're not talking about "theoretically perfect" here. We're talking about a language that's statically typed - the sole benefit of which is type safety unless explicitly overriden (by casts etc) - but which then forgoes this very benefit.

        Furthermore, the only other language I'm aware of which has the same flaw is Eiffel. Neither Java nor C# nor any other language with generics has this. They all either have no variance at all (which is inconvenient by safe), or declaration-site variance (C# 4.0 "in" and "out" on type parameters) which is easier on the API client but does not let you express all relationships, or usage-site variance (Java generic wildcards) which requires API client to understand what it is all about.

        • by aug24 ( 38229 )
          I concur exactly with your null/NPE observations. The next addition I want to the Java spec is the ability to mark a method as never returning null. (Also I want to be allowed to hunt with a shotgun anyone else who tells me that every calling routine should check for null return.)
          • by oever ( 233119 )
            The closure compiler for javascript checks for non-null passing by adding non-nullability to the type. E.g.
            /**
            * @param {?string} input string that may be null
            * @return {!string}
            **/
            function makeDefaultIfNull(input) {
            return (input) ? input : "Default";
            }
        • by amn108 ( 1231606 )

          Talking about initial null references and all, I don't know about your Java compiler, but mine refuses to compile a program where an initially unassigned reference is attempted to be used. That's what it's all about isn't it - if the initial use of a unassigned (null) reference is prohibited at compile-time, then surely nothing will propagate anywhere and make a mess? Please advise ;-)

          Additionally, and regardless of how smart/strict a compiler is, are you saying that you would prefer another constant such a

          • Re: (Score:3, Informative)

            Talking about initial null references and all, I don't know about your Java compiler, but mine refuses to compile a program where an initially unassigned reference is attempted to be used. That's what it's all about isn't it - if the initial use of a unassigned (null) reference is prohibited at compile-time, then surely nothing will propagate anywhere and make a mess?

            No, that's not it. The initial value of an unassigned local variable is "unassigned", not null, which is why the compiler won't let you use it unless all code paths leading to the current point assign or initialize it. But you can still explicitly initialize with null, and then everything I said applies.

            Unassigned fields are initialized to null, and can be used as such with no explicit assignment/initialization.

            Additionally, and regardless of how smart/strict a compiler is, are you saying that you would prefer another constant such as say 'unassigned' (which in fact cannot be assigned explicitly) as a value for unassigned references? Then, if an 'unassigned' value pops up from nowhere at runtime after your program has aborted with a thrown exception, you at least know that it was not a null pointer but that you're using a compiler that cannot tell where an unassigned reference is being used? Just thinking aloud...

            No. The point is that the type system should ensure that a reference that is possibly null cannot

    • by renoX ( 11677 )

      Their main 'competitor' Scala (in my mind) has both covariant and contravariant type system.
      So in the language comparison, they left out covariant and contravariant..
      *Sigh*

  • call be back.... (Score:5, Insightful)

    by batistuta ( 1794636 ) on Tuesday November 09, 2010 @04:48AM (#34171258)

    >> The language itself is not yet open source,

    ok, call me back once it is. I don't really need another programming language, let alone a closed-source once.

  • Gosu is an unrefined mix of cobalt oxide, sodium and other minerals mined in China.

    Yup, so very right.

  • Gosu is Yet Another Slightly Better Than Java programming language.
    • Unless Sun/Oracle finally gets its act together and implements some language improvements, we will see another bunch of those languages. Properties have been requested for ages, closures have been discussed for how long. Dynamic reloading of classes for real hotswapping still is a pain in the arse. Java has done so many things right, but like many other sun technologies it falls short by 5% and then it takes ages to get it in out of the fear of breaking compatibility. I personally wonder if it would not be

      • Properties have been requested for ages, closures have been discussed for how long.

        AFAIK properties are not on the radar, but lambdas are coming in Java 8. You can track the work (both design and implementation - there's already code to try out) here. [java.net]

        To me the Dalvik VM from a modern standpoint makes more sense on bytecode level than the registere based JVM.

        It's Dalvik which is register-based (which makes fast interpreters easier to implement). JVM is stack-based.

  • by acooks ( 663747 ) on Tuesday November 09, 2010 @05:34AM (#34171436) Journal

    Gosu people, your help browser sucks caravans.

    If I middle-click on a link, I don't want the page I'm currently reading to jump away. I want to read whatever is linked to _later_. Redirecting me and then breaking my browser's "Back" button, without even providing an alternative js back button, is unforgivable.

  • plEasE, pROgRAMmerS ArE jUst pEOpLe. One hopes for a language that clears the java crud like the half-fake generics [angelikalanger.com], and gets a case-insensitive language instead...
    • 0RLY? N4h, wh47 w3 w4n7 15 N07 c453 1n53n5171v3, 8u7 4 1337 c4p4813 14n6u463...

      ...or neither since you can develop letter case semantics and follow them precisely (much like your native language and Java do). Third graders are just people too, and are expected to learn proper punctuation in the language they learn.

      Programmers are excused from learning proper English language capitalization, punctuation and spelling (and other written language semantics (like proper "quote usage", and avoiding nested paren

  • New languages for the JVM are cool and all, but still no syntax fixes the problems inherent in the JVM. Mainly, the lack of generics.
    • The problem with generics are not on vm level, it is more the problematic implementation on javas side. The JVM after all is just assembler with high level constructs for classes and data types to some degree, it can scale to any generic implementation you can think of.

  • They invented C#!
  • Not real until you post its operational semantics!

  • But I really like my semicolons (as much as lispers like their parenthesis)

  • To me it looks like or a combination of BASIC and Java, or Java in a much more readable form. I personally liked because I always had the opinion that Java works (if you ignore the fact that it uses RAM like water) but could have a more friendly syntax.

    After all, a programming language syntax does not need to be "encrypted" to be effective.
  • A quick look at the documentation shows that objects/classes are strongly typed, but scalars (i.e. integers) apparently are not. In my experience, you're much less likely to add Apples to Oranges, than you are to add Count of Apples to Count of Oranges. And that also holds true for scalar values used for array indexing, etc.

    So it seems to me that no language should be called 'strongly typed' if it doesn't include a complete type system for scalar types.

The Tao is like a glob pattern: used but never used up. It is like the extern void: filled with infinite possibilities.

Working...