Learning Scala

NSforSG

High Supremacy Member
Joined
Nov 17, 2010
Messages
34,250
Reaction score
2
This shall be my target right after my exam ends!

This thread shall serve as a point where ideas of this programming language, Scala, are exchanged! :D

(I think I have chosen the wrong course in Uni... It's okay, let's move on!)
 

saysuzu

High Supremacy Member
Joined
Oct 31, 2007
Messages
27,562
Reaction score
2
welcome...

but i intend to learn back android programming after exam haha
 

NSforSG

High Supremacy Member
Joined
Nov 17, 2010
Messages
34,250
Reaction score
2
welcome...

but i intend to learn back android programming after exam haha

you study in NUS? i know a bit of android programming, have tried to publish apps on google play, but the apps are quite cui. haha.
 

saysuzu

High Supremacy Member
Joined
Oct 31, 2007
Messages
27,562
Reaction score
2
you study in NUS? i know a bit of android programming, have tried to publish apps on google play, but the apps are quite cui. haha.

i didn't publish apps on google play, because need to pay the membership fee. I know it's cheap, but then again I don't even want to pay that

NTU btw

i intend to create...tamagochi
 

NSforSG

High Supremacy Member
Joined
Nov 17, 2010
Messages
34,250
Reaction score
2
i didn't publish apps on google play, because need to pay the membership fee. I know it's cheap, but then again I don't even want to pay that

NTU btw

i intend to create...tamagochi

haha. like what you have said in another thread, putting the app on google play is just a button click. haha.

i'm from NUS.

Tamagochi? hmm... thought of that before. but i can't draw and i think i will die drawing the graphics. haha.
 

AnimeNewbie

Suspended
Joined
Nov 1, 2003
Messages
8,050
Reaction score
1,966
How come so many ppl think of reviving Tamagochi? My colleague also got the same idea. I also can't draw well. If do game, most probably ask frd for drawing help and I just animate the graphics.

Back to topic, it is amazing Scala can perform better than Java in most cases, considering both compiled to bytecode.

Anyone ever thought of inventing a new (better) language?
 

saysuzu

High Supremacy Member
Joined
Oct 31, 2007
Messages
27,562
Reaction score
2
How come so many ppl think of reviving Tamagochi? My colleague also got the same idea. I also can't draw well. If do game, most probably ask frd for drawing help and I just animate the graphics.

Back to topic, it is amazing Scala can perform better than Java in most cases, considering both compiled to bytecode.

Anyone ever thought of inventing a new (better) language?
old liao...my brain cannot think also
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
Back to topic, it is amazing Scala can perform better than Java in most cases, considering both compiled to bytecode.

Anyone ever thought of inventing a new (better) language?

It's not amazing that Scala does better than Java, it seldom did. Those benchmarks you saw are tailored made Scala benchmark that does better than Java after they are written in such arcane approaches until it defeats the purpose of going with Scala in the first place.

Read more at the following articles
Benchmarking Scala Against Java | Javalobby
Performance of Scala compared to Java - Programmers Stack Exchange

You will find no lack of such articles one saying each if better. However you will also find articles that coincide with my personal stand. Each has their own merits. The fact that both languages compiled to the same set of virtual machine opcodes, we can gladly move up the premises and assume on the VM level there is no apparent advantages.

If you need to write Scala into the way how Java is written just to take advantage of the performance, then effectively you might as well write that portion of the codes in Java.

The value of Scala in my opinion is the expressiveness and effectiveness as a functional language. I am a fan of functional language and often excited at the simplicity and expressive power of a functional language, but one must be trained to think in this matter to code well in functional approaches. it's really a good mind training exercise to better a developer in solving problem.

If you are interested in creating your own language, I must let you know it's not an easy task and before you decided to, having one more language doesn't necessarily means better, it first introduce fragmentation in the development world. Look at the good number of languages we already have, yet only a few of them get used frequently. Next is interoperability is a problem.

However if you have a good reason, methodology, or idea to bring more value to development with this new language, feel free to do so. But don't take it lightly because developing a new programming language is far more involving.

I have taken 2 main courses as introductory into developing programming languages and also in my final year project, I have experience augmenting the C89 programming language with safe typing features, as such I can give you a more deeper insight into programming languages design.

First and foremost, formal language design require skill set in formalizing mathematical inductions and logic inference and several such niche academic concepts into the language. For a new langauge, it must have its own set of semantics and rules. Typing is a very mathematical topic, about inferring the type of a variable, the type of the expression and hence the statement and so forth.

Then you need to have understanding about context-free grammar, lexical analysis, different parsing approaches, forming abstract syntax trees, manipulating them and optimising certain parts of the tree to have a more compact and faster one. Having a program written according to specification doesn't make it a valid programming language, you need to examine and validate the AST to find out which part of the tree is invalid eventhough it satisfy the grammar. Grammar are context free, but programming language processing doesn't need to be.

After these, you need to look at how to convert your AST into opcodes, either working with a register architecture or stack architecture machine(or virtual machine). Working with register architecture is an art, register allocation is a graph colouring problem. You only have limited number of registers at your disposal, so you need to know how to use them appropriately. Stack allocation is much easier though.

Then you need to rack your brains on thread issues. how to provide a language that can handle threading properly, providing synchronization techniques. How to manage the memory properly, if the underlying machine(or virtual machine) doesn't do it for you. Should you have a explicit memory management model, or automatic memory management model ? You also need to devise scoping concepts. Each language have it's own set of rules for scoping. Lisp, Perl, PHP, Java all have different scoping approaches.
Perl for example, have global, dynamic, and local scoping concepts. PHP variables are local by default inside functions and will not float up to the global scope unless explicitly required. Java consist for class scoping and no global scope. If you are designing a functional language, you also need to consider local scoping to closure.

So you see, programming language design is not an easy task. One need a lot of skill set and knowledge to do it, and much more with experience, to do it good. I'm not discouraging you from doing it, I'm just giving you a heads up on what is ahead of you if you decided to give it a try :)
 
Last edited:

NSforSG

High Supremacy Member
Joined
Nov 17, 2010
Messages
34,250
Reaction score
2
How come so many ppl think of reviving Tamagochi? My colleague also got the same idea. I also can't draw well. If do game, most probably ask frd for drawing help and I just animate the graphics.

Back to topic, it is amazing Scala can perform better than Java in most cases, considering both compiled to bytecode.

Anyone ever thought of inventing a new (better) language?

new, better language? hmm... I feel that those that I recently get to know (not necessary learn) are mostly build on languages that are already available in the market.

what drives you to think of inventing a new language?
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top