Re: [Vala] Support for method overloading.



Overloading could easily be supported with mandatory cname or csuffix attributes; that an explicit name needs 
to be given for C is no reason that it needs to be given for vala which could do regular overloading.

I think it ought to be supported.

Sam

-----Original Message-----
From: Jiří Zárevúcky <zarevucky jiri gmail com>
Sent: 08 January 2010 15:25
To: Fabzter <faboster gmail com>
Cc: vala-list gnome org
Subject: Re: [Vala] Support for method overloading.

Fabzter píše v Čt 07. 01. 2010 v 16:01 -0600:
Hi. I have been playing with Vala for some months. I find it to be a really
cool language, thus, I'm thinking in porting an medium sized personal
project from C# to Vala, but it relies heavyly on method and constructor
overloading, and having this features in Vala would make my refactoring work
minimal, so I want to know if vala will ever support this features, you
know, so I can start waiting if they are planned. :)

Short story:
 No.

Long story:
 Vala translates to C, which doesn't support overloading. That means any
overloading in Vala would mean mangling names of methods in C, which
would go against one of the most significant advantages of Vala - being
able to use Vala library the same way as if it was written in C. The
same goes for constructors, you just need to come up with some nice
names. It is also my honest belief that overloading is evil and makes
programmer's work harder.

Side note:
 Be careful with constructors, they work a bit differently in Vala, than
they do in C#.
Side note 2:
 Keep in mind that refcounting behaves very differently from C#'s
garbage collecting. You have greater control, but also greater
responsibility.
Side note 3:
 Those side notes are probably not necessary, but I'm writing them just
in case. :)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]