It is currently 19 Nov 2017, 13:59
   
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: 585
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 85 times
Been thanked: 19 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: 73 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: 585
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 85 times
Been thanked: 19 times


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 1 guest

Login Form