It is currently 16 Apr 2024, 10:23
   
Text Size

Scala?

Moderators: silly freak, CCGHQ Admins

Scala?

Postby silly freak » 21 Aug 2010, 17:52

nantuko84 wrote:I have some experience with Scala. why are you planning to use it in laterna?
btw, idea scala plugin is much better and more stable.
(I tried IDEA shortly, but I didn't feel comfortable with it. However irrational this may sound, it's just what it felt like. Besides either getting used to the different key bindings etc. or customizing them, I got a class path problem because the JDK wasn't put on the classpath by default.)

right now, two things come to mind where scala would really be great:

One, filtering using anonymous functions/match statements. if you look at net.slightlymagic.laterna.magica.util, the classes MagicaPredicates, MagicaFunctions, MagicaSuppliers mostly just handle this problem. They would still exist of course, but would be much shorter and clearer.

Two are the concurrency features, especially applied to the GuiActor class:
Code: Select all
private boolean    ready;
private PlayAction a;

public synchronized void putAction(PlayAction a) {
    ready = true;
    this.a = a;
    notifyAll();
}

public synchronized PlayAction getAction() {
    ready = false;
    while(!ready)
        try {
            wait();
        } catch(InterruptedException ex) {
            ex.printStackTrace();
        }
    return a;
}
this is just too much boilerplate code for every GUI input, and the Actors, as presented here, seem to fit very well, also because they very simply enable to differentiate between various inputs; there are going to be many, especially for combat
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Scala?

Postby Snacko » 23 Aug 2010, 09:12

You can use jetlang to write actors for java with little code, however Java always is verbose and sometimes it's a bit too much compared to Scala.
Snacko
DEVELOPER
 
Posts: 826
Joined: 29 May 2008, 19:35
Has thanked: 4 times
Been thanked: 74 times

Re: Scala?

Postby silly freak » 23 Aug 2010, 16:09

thanks for the tip, works great so far
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times


Return to Development

Who is online

Users browsing this forum: No registered users and 11 guests


Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 11 guests

Login Form