Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (553)
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 7389 times)
0 Members and 1 Guest are viewing this topic.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #30 - Posted 2007-11-07 12:38:02 »

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.

Yeah, something like this looks really handy (near the bottom third of the page). At the moment I get by with comments and asserts, but NullPointerException is probably the most common bug I run into.

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

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #31 - Posted 2007-11-07 14:58:18 »

embedding sql in your code is just bade coding practice

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #32 - Posted 2007-11-07 16:04:17 »

+1 to 'something like a not null modifier'  Smiley
+1 to block-declare visibility with public {}
+1 to const
+1 to static variables inside a method

-1 to multiline strings: It solves nothing and obscures syntax.
-99 to embedding any other language using annotations: It solves nothing and encourages bad practice

Quote
Would like type inference in the language. Never saw the reason to have to type:
Code:
String s = (String) someObject;

as it is perfectly obvious that to assign to s you need a String.

The code
1  
String s = someObject;

implies that a reference is being assigned to someObject. This is only possible if someObject is in fact a String, so imho it's correct that (String) is mandatory here.
If your suggestion would make it, than the above code without (String) could do 2 different things depending on the type of someObject (it would either assign a reference to someObject, or call someObject.toString()).

The whole deal with String is messy enough don't you think? Let's not making it worse just for the sake of a few keystrokes Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 363
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #33 - Posted 2007-11-09 14:06:19 »

Why on earth would it call toString()? I'm only talking about removing explicit casts. There really isn't any need for them most of the time as the type of the receiver is known already and therefore a cast is implicit.

Cas Smiley

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #34 - Posted 2007-11-10 01:53:46 »

Ooooops  Embarrassed you're right, of course it doesn't call toString()... My mind must've been totally elsewhere, and I must have been confused with the behaviour of System.out.println, and the '+' operator for Strings. Man, I feel stupid now  Cry Roll Eyes

Removing explicit casts like you're saying kind of makes sense on one hand, but on the other hand it also makes it more clear at first sight that there's casting going on (but of course that comes from someone easily confused like me  Smiley).
I usually don't mind typing explicit casts anyway, and I usually prefer a bit of verbosity (explicity) over possible vagueness (implicity) in code.

Offline gouessej
« Reply #35 - Posted 2007-11-10 10:11:08 »

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
I agree with you too. On my view, Java mustn't become a clone of C#. Java should better keep simple, simpler than C++ and if Orangy Tang is fed up with Java, no one forces him to go on using it. I don't really see the interests of having a "free" function as the garbage collector does its job fine. Even C++ ISO will integrate an optional garbage collector. The use of "free" in C has a higher cost as you do it directly on the OS. The garbage collector tries to do it at the best moment, it is better on my opinion, it doesn't have the same effect than a "free" call as the JVM handles the memory by itself, it isn't the same mechanism. Orangy Tang made many suggestions of features already present in C++ and Java is a kind of simplification of C++. Complicating Java to get it closer to C++ would be a huge error. Too many programmers think that handling the memory by themselves would be more efficient than delegating this task to the garbage collector but it is a prejudice as many experts of Sun and IBM (Dr. Holly Cummins) said.

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #36 - Posted 2007-11-10 13:24:22 »

I don't really see the interests of having a "free" function as the garbage collector does its job fine. Even C++ ISO will integrate an optional garbage collector. The use of "free" in C has a higher cost as you do it directly on the OS. The garbage collector tries to do it at the best moment, it is better on my opinion, it doesn't have the same effect than a "free" call as the JVM handles the memory by itself, it isn't the same mechanism.

Epic fail.

"Free functions" means functions not associated with a class. Ie. a global main() function, rather than being forced to wrap up all functions inside a class performing the same duties as a namespace. This has nothing to do with the actual free() function, and nothing to do with garbage collection.

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

JGO Kernel


Medals: 363
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #37 - Posted 2007-11-10 13:28:59 »

Hehe, tiny misunderstanding there Wink

Not sure why free functions are so useful...? Is it just being able to define them when you don't have the original source? (Ie. bolt ons to a library)?

Cas Smiley

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #38 - Posted 2007-11-10 13:43:35 »

Because it's a simple feature which should be present in the first place, rather than the slightly hacky way of forcing people to use static member functions. On a more practical note, I often find myself writing lots of static functions which don't actually belong anywhere specifically, and you end up either with lots of FooUtilities classes or bundling them in with an existing class and bloating it up. And when you've got a Frobnicate(Foo, Bar) then it's non-obvious where that should live.

It also gets nicer when you add multimethods and/or templated code over the top so you can just call Frobnicate() and depending on the actual arguments different method implementations get called - possibly even ones outside of your module which other people have bolted on. You can't do that if you're forced to specify a class to call the method on every time.

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

Senior Member




shiny.


« Reply #39 - Posted 2007-11-10 14:40:05 »

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)

And makes it equally unmaintainable (like PHP*)

*PHP written badly, like mixing presentation and logic.
if thats really what your thing use PHP + JAVA + Quercus

Quote
"Free functions" means functions not associated with a class. Ie. a global main() function, rather than being forced to wrap up all functions inside a class performing the same duties as a namespace. This has nothing to do with the actual free() function, and nothing to do with garbage collection.
I fail to see the added value here. //edit Perhaps its too alien to me as only parsely write static methods like the ones you outlined. //edit2 Frobnicate seems like something very general and unspecific. perhaps its a bad example
Quote
Would also love to block-declare visibility with public {}, but only variable declarations as methods are usually spaced much further apart.
Write an ide plugin for that?

also the syntax mentioned before with removing the {}, is tbh goddam awefull. If you keep your cyclomatic complexity down as you (inmost cases) should, Indents are hardly any problem next to that any decent ide supports single/double space indentation coupled with widescreen monitors coupled with monitor sizes of these days. sorry It doesn't make sense to me.

about const there are 2 'bugs' with a lot of votes that are related.

About closesures and the prosposed long hand syntax well yeah it's ugly.(short hand is nice, and gets my support) I'm not sure what to change the long bit into, I gotta mount a defence to that. Since it's only needed whenn defining a clossure It can be longer then the long hand syntax is now.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline fletchergames

Senior Member





« Reply #40 - Posted 2007-11-11 05:08:22 »

I kind of agree that methods shouldn't have to be part of a class, but how are you going to call them from other classes?  Let's say I have the file MyFile.java that contains the method void myMethod() that isn't in a class.  When I import MyFile, do I just call it as myMethod()?  I wouldn't want to get it confused with a class (or, even worse, another classless file) that happened to contain another myMethod() method.

I guess you could do something like make each "free" method name start with #, a character that isn't used elsewhere in Java.  That would separate all such methods from class methods, but not resolve naming conflicts with eachother.

I kind of long for a Java-ish version of delegates, one of the few features of C# I actually like.  I want to be able to implement interfaces in a delegate-ish way, but I don't want to pass a bunch of method pointers around to use willy-nilly.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #41 - Posted 2007-11-11 12:49:14 »

I kind of agree that methods shouldn't have to be part of a class, but how are you going to call them from other classes?  Let's say I have the file MyFile.java that contains the method void myMethod() that isn't in a class.  When I import MyFile, do I just call it as myMethod()?  I wouldn't want to get it confused with a class (or, even worse, another classless file) that happened to contain another myMethod() method.

Meh, I think you're overexagerating the problem. You can already get name collision issues when you've got two classes with the same name, or a local method in an inner class with the same name as a method in the outer class (and probably a whole bunch of other ways I can't think of right now). The situation is the same - just specify it in shorthand "foo()" if theres no collisions, otherwise you need the fully qualified name "net.orangytang.foo()".

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

Senior Member




shiny.


« Reply #42 - Posted 2007-11-11 20:00:51 »

...start with #, a character that isn't used elsewhere in Java...
setting the actual discussion aside what is this need for using weird characters everywhere? for the sake of avoiding reserved names? Are we fooling our selfs?

yeah, maybe I'm just ranting but I really hate icky freaky weird meaningless characters. Like the => proposed in the closures.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline fletchergames

Senior Member





« Reply #43 - Posted 2007-11-12 03:52:16 »

The # thing might be going a little overboard, but using strange symbols can make things alot simpler (though somewhat more cryptic at the same time).  Personally, I think the ? : operator is a little cryptic, but it's a great operator.  And it does sort of make sense.  The ? means there's a choice, and the : separates the 2 choices like with the cases in a switch statement.
Offline princec

JGO Kernel


Medals: 363
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #44 - Posted 2007-11-12 09:31:26 »

Yeah but we're all used to the ? operator. It's when people start wanting to add all the other crazy stuff and it ends up just being as unreadable as C++. Just look at any really hairy bit of generic code.

Cas Smiley

Offline Don Kiddick

Junior Member





« Reply #45 - Posted 2007-11-12 10:06:04 »

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

Intellij has a "not null" and nullable annotation which work well.

http://www.jetbrains.com/idea/documentation/howto.html

Although generally I try and use NullObjects and avoid using null as much as possible. This is particularly true when returning collections or strings. It's rare that there is a semantic difference between returning a null and an empty collection or string, so I like to avoid the null and prevent the possible NPE.

YMMV.

D.

Offline grom358

Senior Newbie





« Reply #46 - Posted 2007-11-28 02:19:44 »

I am trying to decide between
* Java 1.6
* Nice
* Scala

I really like the extra features of Nice and Scala but not sure if its worth using something less people are familiar with. Does anyone here have any experiences with using Nice or Scala as the main programming language for game programming?
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.

CopyableCougar4 (24 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56

Norakomi (42 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!