Jump to content

Recommended Posts

Posted

Off topic: gotta love when the mod replies, it's like an official formatted response

On topic: thank you for you explanation I'll make sure to look into that link, also what's kotlin?

Posted

Pattern Matching, Lambda's and many other features far exceed that of java.

 

Pattern Matching is effectively a Switch/Case statement on steroids... In Java 8 the Switch statement has been improved to allow things like switch with Objects such as strings, rather then just primitives. But it's not as good as scala. Lambda's also are in Java 8, but the problem is, you cant expect everyone to update to a "beta" version of java to use your mod.

 

That leads me to my next point. Everything is done using JVM, there is no language levels etc. Which means you can use all the fancy stuff like pattern matching/lambda's, while still using Java 7, which most users have installed on their PC.

 

Test have show That scala is only 3x slower then C.... Now this is probably not a perfect statistic. But to me that is fairly decent for the type of language it is. It's basically on par with Java, Runtime wise, with writing less code. to look at this more in depth go here http://benchmarksgame.alioth.debian.org/

 

Its a diverse language, while Java is Object orientated, scala is both Object and Function based. However this is only a good thing if you use it appropriately, Attempt to think in the Scala train of thought, rather then Java, there are heaps of youtube videos on this.

 

Objects/Class separations fixes alot of the confusions people have with the static modifier in java, in my mind it is easier to understand.

 

Although languages such as groovy follow closer too Java syntax, Scala isn't that hard to grasp, It's not like learning an entirely new language. It's clear and simple to understand.

 

Personally for me (as I am currently moving from java to scala). It's like when i moved from Eclipse Kepler to IntelliJ IDEA. I doubt I will ever look back. I do think it will take a month or two for me to fully start to understand scala, but when I do I feel that it's a direction I would like to head.

 

It seems that Scala is improving at a faster rate then java, and you aren't restricted by versions. For instance: We wont be able to use Java 8 functionally for a long time, because the userbase has to update their Java install, whereas as soon as scala updates, you can instantly use the new features in your code, the compiler sorts out the rest.

 

I just recently updated my mod to 1.7 (Thats coded in Java), however I decided to start the conversion to scala (although I'm think an interior mod rework is on the cards at the same time as I convert haha, especially while I wait for deobfuscation/an "Official" 1.7.4 forge version to be released)

 

If you want more information watch this speech (this is the source of most of my information)

The difference between stupidity and genius is that genius has its limits. - Albert Einstein

  • 3 weeks later...
Posted

Pattern Matching is effectively a Switch/Case statement on steroids... In Java 8 the Switch statement has been improved to allow things like switch with Objects such as strings, rather then just primitives.

 

Java 7 allows that, too. http://docs.oracle.com/javase/7/docs/technotes/guides/language/strings-switch.html

 

I am also thinking of writing my mods in Scala. However, I want my mods to be compatible with older minecraft versions (1.4.7+). Did forge support scala back then?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.