Scala: pre-initialize val while extending a class

How do I pre-initialize a val and extend a class in Scala?


object Start {
  def main(args: Array[String]): Unit = {
        new T()
        new T2()

class T extends{val z = 10} with X  with Y
class T2 extends X with Y {val z=10}
//class T3 extends{val z = 10}  ??? Z with X with Y //????

class Z

trait  X {
  val z :Int

trait Y { this :X =>
  println("Test: "+z)  



class T3 extends {val z = 10} with Z with X with Y

Scala Language Specification 2.9, 5.1.6:

EarlyDefs ::= ‘{’ [EarlyDef {semi EarlyDef}] ‘}’ ‘with’

So an early definition always has to be followed by a with

Need Your Help

How to edit and save photo in Windows Store App?

c# windows-8 windows-store-apps

I make some application which edit photo and save it in other location. So I find a question which shows how to resize photos in Windows Store Apps. Then I implement it in my program:

Does Closing A RecordSet in VB 6.0 Update the Database?

vb6 ado recordset vb6-migration

I am converting VB 6.0 code to VB.Net. In the VB 6.0 code I see the following use of a recordset

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.