Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (531)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Alternative Java-based languages  (Read 7360 times)
0 Members and 1 Guest are viewing this topic.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Posted 2007-11-05 16:36:29 »

I feel like I'm in something of a rut with Java at the moment, as a language it's feeling increasingly restricted and I'd like to try something new. Since I've got far too much existing code I'd rather not throw away, it'd be good to choose something which can call existing Java code easily.

Currently I'm still stuck in the past with 1.4, so ideally any alternative would also run on 1.4. Possible ideas are:

AspectJ
Looks interesting, and seems to have good support (particularly since it looks like it's got good Eclipse plugins). Not sure what I think of the language though.

Nice
The language looks, uh, nice. But doesn't seem particularly well supported. Has an Eclipse plugin but doesn't look very complete.

Jython
Nice language, but lack of type safety gives me The Fear for anything non-trivial.

Pnuts
Java scripting language I've seen recommended a few times but havn't actually tried. Anyone used this?

Java 1.5
Or maybe I should bite the bullet and just switch to 1.5. Doesn't really address many of my gripes, but better than nothing. Mac people running 1.4 can just go and upgrade already. Tongue

Any obvious/non-obvious ones I've missed? Anyone tried any of the above and have any comments or recommendations?

Cheers

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 742
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2007-11-05 19:31:37 »

Java can indeed be restrictive.

But when you want to move to something else, you might as well tell us
what you find restrictive, or we wouldn't be able to name the proper alternative. Smiley

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #2 - Posted 2007-11-05 19:44:48 »

I'm not entirely sure I know myself. Huh Ideally I guess I'd like some of the RAII from C++, and better handling of functions and interfaces. Stuff like multimethods and first class functions could probably reduce the copious amount of instanceof usage I've been straying into recently. Nice seems like it's got the right ideas, perhaps I'll give the eclipse plugin a try and see how well it holds up.

Unfortunately the bigger problem is that Java has about the best IDEs around, and anything else is going to be a step down by comparison.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 742
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2007-11-05 20:09:36 »

I've been trying to walking away from Java for a while, just to find out inferiour IDEs which bounced me back right to Java.

After having coded PHP/CSS/DOM/DHTML/AJAX/etc/etc/etc at work, for a few months, I have felt the freedom, and at the same time, the bunch of horrific errors you get when typesafety is lost.

I've pretty much given up... there aint much besides Java with such good documentation, mature libraries and a good IDE. These three are required for productivity, in my opinion.


Are we stuck?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline fletchergames

Senior Member





« Reply #4 - Posted 2007-11-05 20:18:49 »

I'm going to buy a book about AspectJ on Amazon.com after I move just because I can get it for a few bucks plus shipping.

Personally, I would like something that's just a little less verbose than Java but has roughly the same functionality.  This would be no good if I couldn't use libraries of code similar to the ones that come with the JRE.  There are things that I can do without.  I can even do without the AWT, but I need to have some way to at least create a graphical application window and switch between full-screen exclusive mode and regular mode.  And I need to have sound support similar to Java's.

Some examples of verbosity:

imports:

import java.awt.*;

I would prefer to just type "import java.awt;"

indentation:

public class A extends B implements C {
   //indent here
  public void method() {
     //indent twice here
  }
}

Since I usually have one main class per file, there's no need for indentation within the class.  In fact, I would rather have it be LIMITED to one main class per file (though inner classes would still be allowed).  The syntax could just be:

public class A extends B implements C;

public void method() {
   //indent only once
}

That may sound a little bit pendantic, but I'm indenting most of every file for nothing.  If I have 3 nested for loops, my variable names take up all the space I have available after indentation.  Some people would call this bad programming practice and tell me that my code is too complicated.  I call this "why shouldn't my code fit on the screen".

In practice, I actually don't indent the main class in the file, but Eclipse fights me on this by auto-indenting too far.

access modifiers:

In Java, I type:

public void methodA() {}

public void methodB() {}

...

public void methodZ() {}

In C#, I can type:

public {
   void methodA() {}

  void methodB() {}

  ....

  void methodZ() {}
}

I would much rather type:

public:

void methodA() {}

void methodB() {}

....

void methodZ() {}

Granted, it's not immediately obvious upon looking at a method in the middle what it's access modifier is.  In a class, I have all my public methods/classes/variables first, protected second, package third, and private last.  I think that makes good sense and allows the access modifier blocks to be adequately descriptive.

no "final" required for parameters:

I have to type:

public void methodA(final int a, final int b, ..., final int z)

to make it so I can't set parameter variables equal to other values.  This should just always be the case, no "final" required.

simpler enums:

This isn't too important (and may be slightly off topic), but enums don't need to have the capability to define different methods on each element of the enum.  I think this kind of breaks enums a bit, but it does make them more powerful.  I don't normally use this capability.

I love enums, but I have a minor objection to them.  If you define a static final variable in an enum class definition, you can't use it in the enum element constructor calls.  I define a separate class to store flag constants because of this.  I don't know if this can be fixed though because static variables are probably defined after enum elements so that the enum elements can be used in the variables.

simpler Runnables:

I understand that Runnable is an interface and has to be implemented this way.  However, I don't want to type:

Runnable myRunnable = new Runnable() {
   public void run() {
      //method here
   };

It's not that big of a deal.  I just have to type it alot.  There should be some abbreviation, like the following:

Runnable myRunnable = {
   //method here
};

Essentially, I want to be able to define code blocks as variables, just like in functional programming languages.  It's basically C# delegates, though less verbose.  For methods with parameters, I could type:

ActionListener myListener(ActionEvent event) = {
   //method here
};

This would basically be a shortcut for one-method interfaces.  The one-method interfaces would just be delegates instead.
Offline fletchergames

Senior Member





« Reply #5 - Posted 2007-11-05 20:19:35 »

I think that if we want a better language, we'll have to write it ourselves.  I just don't have the skill or the time to do so.
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #6 - Posted 2007-11-05 21:37:05 »

scala seems nice

Offline ryanm

Senior Member


Projects: 1
Exp: 15 years


Used to be bleb


« Reply #7 - Posted 2007-11-05 21:44:38 »

@fletchergames

It's not a full solution, but Eclipse does help with a couple of these niggles.

Class indentation: The code formatter is pretty configurable. You can set it to not indent declarations within class bodies, giving the effect you're after. Not sure what happens with nested classes though. (This is version 3.3 btw )

Declaring anonymous classes: Enter "Runnable myRunnable = new Runnable(" and hit ctrl+space. Eclipse will fill in the rest for you. If you're extending a class you'll get a popup to choose which methods to override.

Block modifiers for public/private etc: It's six and half a dozen. You group your fields and methods by modifier, I group them by functionality. eg: a public method is followed by the private methods that it uses.

Import statements: I reckon you'll need to just suffer the cost (?) of two additional characters, in order to distinguish between classes and packages. In your example, what happens if some wag sticks a class called "java.awt" on the classpath?
Besides, who still types import statements?

IMHO anyway.
Offline ChrisM

JGO Coder


Medals: 1
Projects: 1


END OF LINE.


« Reply #8 - Posted 2007-11-05 23:15:16 »

@OT

Instead of trying something new in another language, that you feel will be an inferior experience anyway, why not push to do something you have never done in Java before?  A different kind of app, something that challenges your skills in a particular area, etc.

Offline Jackal von ÖRF

Junior Member





« Reply #9 - Posted 2007-11-05 23:22:00 »

Some examples of verbosity:
Most of those things, which you say require typing too much, are fully or partially automated by modern IDEs (personally I prefer IDEA).
- imports: The IDE adds them automatically. No manual typing has been needed for years.
- indentation: The IDE can indent and reformat the code automatically. I don't even think about code formatting when writing code (except when using JMock), because the IDE takes care of it automatically during typing or with the press of a key shortcut. If you don't want to indent the top level class members, just configure the code formatter (requires only checking one checkbox in IDEA's code style settings).
- access modifiers: Having such access modifier blocks or sections would limit the ordering of the methods far too much and possibly reduce the code's readability. No thanks. I prefer the methods to be in a logical order, not sorted by syntax.
- no "final" required for parameters: In IDEA, enable the inspection "Assignment to method parameter".
- simpler enums: Java's enums can indeed be quite complicated. It's better to use them only in a simple way. Otherwise other people might have problems understanding your code.
- simpler Runnables: Java is quite verbose, so having a shorter syntax might improve readability. Typing, however, is not a problem because the IDE does all of that. In IDEA I just write Runnable r = new <Ctrl+Shift+Space, Enter> and the rest is autocompleted.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 742
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2007-11-05 23:45:18 »

Between my last post in this thread, and now, I've written a little java-dialect...

Featuring:
  • coding without a surrounding class
  • defining methods
  • multi-line strings
  • closure-like thingies
  • inner classes
some code in this java-dialect


Janino is a great tool.. this might keep me from switching to PHP for my TinyCode webserver-project. Multi-line strings are such a must-have.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline fletchergames

Senior Member





« Reply #11 - Posted 2007-11-06 00:15:17 »

Class indentation: The code formatter is pretty configurable. You can set it to not indent declarations within class bodies, giving the effect you're after. Not sure what happens with nested classes though. (This is version 3.3 btw )
I checked this, and I already have the code formatter configured the way I want it to be.  It works when generating code automatically and when adding new lines in the middle of a preexisting class.

For some reason, it doesn't always work when using the refactoring tool to move code to a new class.  I've encountered a few other nuisance cases when there's a syntax error in the code, but I really can't blame anyone for that.

I guess I really shouldn't be complaining about this since it's not so bad now that I use Eclipse.  It's really a matter of personal preference more than a language feature.

Declaring anonymous classes: Enter "Runnable myRunnable = new Runnable(" and hit ctrl+space. Eclipse will fill in the rest for you. If you're extending a class you'll get a popup to choose which methods to override.
I didn't know about that.

I suppose most of things I mentioned really aren't that big of a deal.  They're just things I like to gripe about.

Between my last post in this thread, and now, I've written a little java-dialect...

Featuring:
  • coding without a surrounding class
  • defining methods
  • multi-line strings
  • closure-like thingies
  • inner classes
some code in this java-dialect


Janino is a great tool.. this might keep me from switching to PHP for my TinyCode webserver-project. Multi-line strings are such a must-have.
That's not a bad little dialect.

The thing I don't like about PHP is that it looks like it should have nice features like type safety but really doesn't.  You can write classes in PHP, but they are somewhat lacking.
Offline zendar

Senior Newbie




Go Java!


« Reply #12 - Posted 2007-11-06 00:49:31 »


If you are feeling adventurous, you could try out JRuby ( http://jruby.codehaus.org/ ). Netbeans6 beta has support for it, and it is Java-based Ruby implementation that lets you interact with Java pretty easily.  Cool
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #13 - Posted 2007-11-06 01:04:21 »

Are we stuck?

I don't know. The more I think about it the more I think the only practical solution is the well-established method of intergrating a scripting language and flicking between the two based on whatever bit of functionality you're writing. Unfortunately this tends to waste your time dealing with odd bugs and behaviour at the glue/interface layer, and while it might be an overall win, it's not particularly pleasant.

Perhaps we can find something similar to CppHeresy but for Java and using Jython/Nice/Something  instead of Python.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #14 - Posted 2007-11-06 01:11:05 »

My personal wish list:

1. Proper C++ style 'const' so I don't have to keep creating Immutable interfaces.
2. First class functions, so I can do signals and slots.
3. Some form of RAII, so I don't have to remember to do tedious tidying up code.
4. Templates/generics to remove all those goat-awful casts from everywhere.
5. Multimethods, to remove all the instanceof scattered everywhere.
6. Free functions.

Things I really don't want to loose:
1. Language-level support for asserts.
2. Robust type safety and exceptions with stack traces.
3. Reflection.
4. Garbage collection.

Ironically, the first list are mostly available in C++ (or you can get 90% of the way there with some creative hacking), yet the second list is totally absent from C++.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 742
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #15 - Posted 2007-11-06 01:33:22 »

And performant I guess..


Looks to me like it would take a whole bunch of people, a few years to knock up v0.1

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #16 - Posted 2007-11-06 11:25:35 »

Between my last post in this thread, and now, I've written a little java-dialect...

Featuring:
  • coding without a surrounding class
  • defining methods
  • multi-line strings
  • closure-like thingies
  • inner classes
some code in this java-dialect


Janino is a great tool.. this might keep me from switching to PHP for my TinyCode webserver-project. Multi-line strings are such a must-have.

Ugh, I can't say I like your dialect, sorry   Shocked Roll Eyes
Multi-line strings just makes things hard to read (just one example is that there's no way to see how many spaces are there between lines). What's wrong with a '+' between lines? It's clear and hardly more verbose.
What problems with java does your dialect solve?

Offline zero

Junior Member





« Reply #17 - Posted 2007-11-06 11:34:47 »

Personally, I do more and more programming in Scala. It has lots of features mentioned here and its performance profile is equal to Java (or even better like in this particular raytracing benchmark)
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #18 - Posted 2007-11-06 13:26:39 »

The world as a whole would run a lot more efficiently if there weren't so many frickin' languages around!

I don't see programming languages being all that different; more = fragmentation = bad.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Sandman

Innocent Bystander





« Reply #19 - Posted 2007-11-06 13:39:22 »

Quote
The world as a whole would run a lot more efficiently if there weren't so many frickin' languages around!

I don't see programming languages being all that different; more = fragmentation = bad.

You mean like all the Application Server and Web Framework choices in the Java world  Wink
Offline purpleguitar

Junior Member





« Reply #20 - Posted 2007-11-06 14:33:49 »

My personal wish list:

[snip]
5. Multimethods, to remove all the instanceof scattered everywhere.

I fall into the "instanceof is evil" camp.  It seems to lead to abstruse coupling and maintenance problems.  I have found two ways to avoid using instanceof:

1. Refactor.  Having type-dependent code outside of the dependent class is often an indicator that refactoring is necessary to improve the design.  Put the type-dependent logic into the class and call a common method rather than checking the type from outside.  Disciples of Alan Kay would argue that this is "True OOP", focusing first on the messages that are passed between collaborating objects, then on the objects themselves.

2. Visitor pattern.  If I have type-dependent logic that is truly extrinsic to the type, the Visitor pattern solves this problem.  It requires a little bit of overhead with respect to interface declarations, but it's a useful pattern when not abused.  One of the biggest advantages, in my opinion, is that you essentially have to freeze your type hierarchy for it to be effective, and doing this forces you to think through the design before further coding.  This can reveal other problems in the design, unrelated to this particular problem.  The other advantage is that if you do end up changing the visitor-enabled type hierarchy, the compiler will help you find missing cases, where it cannot help with cascading if-instanceof-else blocks.

I hope that's helpful, and of course, ymmv.

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #21 - Posted 2007-11-06 14:52:55 »

I fall into the "instanceof is evil" camp.  It seems to lead to abstruse coupling and maintenance problems.  I have found two ways to avoid using instanceof:

1. Refactor.  Having type-dependent code outside of the dependent class is often an indicator that refactoring is necessary to improve the design.  Put the type-dependent logic into the class and call a common method rather than checking the type from outside.  Disciples of Alan Kay would argue that this is "True OOP", focusing first on the messages that are passed between collaborating objects, then on the objects themselves.

2. Visitor pattern.  If I have type-dependent logic that is truly extrinsic to the type, the Visitor pattern solves this problem.  It requires a little bit of overhead with respect to interface declarations, but it's a useful pattern when not abused.  One of the biggest advantages, in my opinion, is that you essentially have to freeze your type hierarchy for it to be effective, and doing this forces you to think through the design before further coding.  This can reveal other problems in the design, unrelated to this particular problem.  The other advantage is that if you do end up changing the visitor-enabled type hierarchy, the compiler will help you find missing cases, where it cannot help with cascading if-instanceof-else blocks.

I hope that's helpful, and of course, ymmv.


Usually I go with (1), however when using some frameworks (particularly, while writing an eclipse plugin) instanceof is pretty much a requirement. And because it usually involves interfaces and objects which are part of the framework, you can't refactor or change things. Since the standard practice doesn't see instanceof as evil, they're quite happy to leave things as they are (probably a valid POV, but not one I share).

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 742
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #22 - Posted 2007-11-07 00:29:04 »

Ugh, I can't say I like your dialect, sorry   Shocked Roll Eyes
Multi-line strings just makes things hard to read (just one example is that there's no way to see how many spaces are there between lines). What's wrong with a '+' between lines? It's clear and hardly more verbose.
What problems with java does your dialect solve?

Have you ever worked on a text-orientated program?

1  
2  
3  
4  
5  
6  
7  
8  
StringBuilder sb = new StringBuilder();
sb.append("<html>\n");
sb.append("   <head><title>"+myTitle+"</title></head>\n");
sb.append("<body>\n");
sb.append("   <h1>"+myHeader+"</h1>\n");
sb.append("   "+myText+"\n");
sb.append("</body>\n");
sb.append("</html>\n");


Believe me, it gets VERY annoying. Try to write some javascript inthere and you'd cry. Working with templates or external files where variables get search-and-replaced in code, solves only part of the problem, but are very restricting when building truely dynamic pages.

With my knocked up dialect it would become:

1  
2  
3  
4  
5  
6  
7  
8  
9  
String message = """
<html>
   <head><title>"
""+myTitle+"""</title></head>
<body>
   <h1>"
""+myHeader+"""</h1>
   "
""+findContent(myPageID)+"""
</body>
</html>
"
"";


Making the parser slightly more intelligent would allow to turn all """ into " and keep the functionality.


Further, it makes it easier to mix functionality and layout in 1 file. That's not really neat, but it's damn convenient (like PHP)

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline DzzD
« Reply #23 - Posted 2007-11-07 02:12:17 »

I'm going to buy a book about AspectJ on Amazon.com after I move just because I can get it for a few bucks plus shipping.

Personally, I would like something that's just a little less verbose than Java but has roughly the same functionality.  This would be no good if I couldn't use libraries of code similar to the ones that come with the JRE.  There are things that I can do without.  I can even do without the AWT, but I need to have some way to at least create a graphical application window and switch between full-screen exclusive mode and regular mode.  And I need to have sound support similar to Java's.

Some examples of verbosity:

imports:

import java.awt.*;

I would prefer to just type "import java.awt;"

indentation:

public class A extends B implements C {
   //indent here
  public void method() {
     //indent twice here
  }
}

Since I usually have one main class per file, there's no need for indentation within the class.  In fact, I would rather have it be LIMITED to one main class per file (though inner classes would still be allowed).  The syntax could just be:

public class A extends B implements C;

public void method() {
   //indent only once
}

That may sound a little bit pendantic, but I'm indenting most of every file for nothing.  If I have 3 nested for loops, my variable names take up all the space I have available after indentation.  Some people would call this bad programming practice and tell me that my code is too complicated.  I call this "why shouldn't my code fit on the screen".

In practice, I actually don't indent the main class in the file, but Eclipse fights me on this by auto-indenting too far.

access modifiers:

In Java, I type:

public void methodA() {}

public void methodB() {}

...

public void methodZ() {}

In C#, I can type:

public {
   void methodA() {}

  void methodB() {}

  ....

  void methodZ() {}
}

I would much rather type:

public:

void methodA() {}

void methodB() {}

....

void methodZ() {}

Granted, it's not immediately obvious upon looking at a method in the middle what it's access modifier is.  In a class, I have all my public methods/classes/variables first, protected second, package third, and private last.  I think that makes good sense and allows the access modifier blocks to be adequately descriptive.

no "final" required for parameters:

I have to type:

public void methodA(final int a, final int b, ..., final int z)

to make it so I can't set parameter variables equal to other values.  This should just always be the case, no "final" required.

simpler enums:

This isn't too important (and may be slightly off topic), but enums don't need to have the capability to define different methods on each element of the enum.  I think this kind of breaks enums a bit, but it does make them more powerful.  I don't normally use this capability.

I love enums, but I have a minor objection to them.  If you define a static final variable in an enum class definition, you can't use it in the enum element constructor calls.  I define a separate class to store flag constants because of this.  I don't know if this can be fixed though because static variables are probably defined after enum elements so that the enum elements can be used in the variables.

simpler Runnables:

I understand that Runnable is an interface and has to be implemented this way.  However, I don't want to type:

Runnable myRunnable = new Runnable() {
   public void run() {
      //method here
   };

It's not that big of a deal.  I just have to type it alot.  There should be some abbreviation, like the following:

Runnable myRunnable = {
   //method here
};

Essentially, I want to be able to define code blocks as variables, just like in functional programming languages.  It's basically C# delegates, though less verbose.  For methods with parameters, I could type:

ActionListener myListener(ActionEvent event) = {
   //method here
};

This would basically be a shortcut for one-method interfaces.  The one-method interfaces would just be delegates instead.

there are some good shortcut but it is not really related to Java, I mean it is quite easy to write your own pre-compiler program that convert your shortcut to Java :

1  
2  
3  
public:
void methodA() {}
void methodB() {}

convert to
1  
2  
public void methodA() {}
public void methodB() {}


same for :

1  
2  
3  
4  
5  
public class A extends B implements C;

public void method() {
   //indent only once
}

can be converted by a pre-compiler to:
1  
2  
3  
4  
5  
6  
7  
public class A extends B implements C
{
 public void method()
 {
   //indent only once
}
}


most of the shortcut you mention can be threated by a pre-compiler program, or an IDE plug, no ?




Offline fletchergames

Senior Member





« Reply #24 - Posted 2007-11-07 06:46:22 »

there are some good shortcut but it is not really related to Java, I mean it is quite easy to write your own pre-compiler program that convert your shortcut to Java :

1  
2  
3  
public:
void methodA() {}
void methodB() {}

convert to
1  
2  
public void methodA() {}
public void methodB() {}


same for :

1  
2  
3  
4  
5  
public class A extends B implements C;

public void method() {
   //indent only once
}

can be converted by a pre-compiler to:
1  
2  
3  
4  
5  
6  
7  
public class A extends B implements C
{
 public void method()
 {
   //indent only once
}
}


most of the shortcut you mention can be threated by a pre-compiler program, or an IDE plug, no ?
True.  Or, in some cases, by macros or code generators.

The problem is that all these things are little nuisance things, not really worth doing alot of work over.  But if I were going to create my own language anyways, I would be sure to include these features.

I guess my original post was a little off topic because I'm talking more about formatting than about actual language features.
Offline EgonOlsen
« Reply #25 - Posted 2007-11-07 08:11:00 »

Am i the only one around here who prefers typing a few more characters instead of introducing the next crude syntax extension just to save a few of them? I never understood why programmers argue that typing is a bad thing. If you don't want to type, get out of programming... Wink

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #26 - Posted 2007-11-07 08:47:04 »

Am i the only one around here who prefers typing a few more characters instead of introducing the next crude syntax extension just to save a few of them? I never understood why programmers argue that typing is a bad thing. If you don't want to type, get out of programming... Wink
nope, I totally agree with you - and you can have a lot of IDE stuff to handle all of the syntactic sugar.
The problem arises when you want to introduce new features that can't be handled by the current language. Stuff like Generics.

This made my skin crawl tho:
1  
public static <T> void foreach(T[] ts,{T,{=>void},{=>void}=>void} block)

generics and closures  Lips Sealed

Offline kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #27 - Posted 2007-11-07 09:11:39 »

I've always thought that the coding bit of the end is the bit that takes the shortest time, and so optimizing how many bits and pieces you have to type seems pretty fruitless. I mean the ideas and design before hand is the everso expensive bit - I'd really like some optimizations that make me think more quickly Smiley

That said:

Quote
1. Proper C++ style 'const' so I don't have to keep creating Immutable interfaces.
2. First class functions, so I can do signals and slots.
3. Some form of RAII, so I don't have to remember to do tedious tidying up code.
5. Multimethods, to remove all the instanceof scattered everywhere.
6. Free functions.

Are all the things I've always wanted in the language, not really to decrease verbosity but to improve robustness and help in creating safe and apt code (assuming you use them).

I took this one out:

Quote
4. Templates/generics to remove all those goat-awful casts from everywhere.

for standard rant reasons. It's a great feature but too open to misuse which leads to sloppy coding for my money.

Kev

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #28 - Posted 2007-11-07 10:44:32 »

I took this one out:

for standard rant reasons. It's a great feature but too open to misuse which leads to sloppy coding for my money.

Kev
To be fair, I havn't had a ClassCastException that generics would have prevented in years. Generics are probably the most droppable from that list.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline princec

JGO Kernel


Medals: 340
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #29 - Posted 2007-11-07 13:23:28 »

The thing that normally catches me out is NPEs. So I'd really rather like a "not null" modifier for variable declarations. Eclipse already goes some way to detecting that something may be null when referenced but I want to be able to declare that at the interface level. My code is full of comments like
1  
@return a String, or null if the value isn't found

or
1  
@param coords The location of the gidrah (may not be null)

and it'd just be nice to formalize it.

+1 for const.

Dunno what RAII is so probably don't need it.
Already use generics when I can - very sparingly they work well.
Would love to implement single-method interfaces with a shorthand syntax.
Would also love to block-declare visibility with public {}, but only variable declarations as methods are usually spaced much further apart.
Would like to be able to declare static variable inside methods; thereby restricting scope. Very handy for certain sorts of debugging.
Almost never ever use instanceof as there's a design pattern to avoid it.
Would like type inference in the language. Never saw the reason to have to type:
1  
String s = (String) someObject;

as it is perfectly obvious that to assign to s you need a String.
Would like to be able to embed any other language I want into Java source code using an annotation:
1  
2  
3  
4  
System.out.println("Blah blah");
ResultSet rs = @sql {
select * from records where wibble="wobble"
}

(and xml, and html, etc, etc)
+1 for multiline strings but why not just simply not terminate each line with the "
And I want BLOODY STRUCTS somehow. Well, mapped objects.

Cas Smiley

Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (13 views)
2014-07-24 01:59:36

Riven (14 views)
2014-07-23 21:16:32

Riven (13 views)
2014-07-23 21:07:15

Riven (15 views)
2014-07-23 20:56:16

ctomni231 (43 views)
2014-07-18 06:55:21

Zero Volt (39 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (50 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!