In other words, because this isn't allowed in AS3--
public function MySignal(...valueClasses)
{
super.apply(null, valueClasses);
}
--Signal now allows you to do this:
public function MySignal(...valueClasses)
{
super(valueClasses);
}
I also moved constructor logic out to a protected function
setValueClasses(), which can be overridden or called with super.
Here's the commit:
http://github.com/robertpenner/as3-signals/commit/a4b2a6b6478a22a341f9ffcd698f086f9d374465
I plan to apply this to DeluxeSignal as well.
On Mon, Dec 7, 2009 at 3:15 PM, Robert Penner <in...@robertpenner.com> wrote:
>> class MySignal{
>> public function MySignal(...valueClasses){
>> super([MyForcedClass1,MyForcedClass2].concat(valueClasses));
>> }}
>
> That doesn't look like it will work, because you're only passing one
> argument, an array, to super().
>
> I'm not sure if you can do super.apply(null,
> [MyForcedClass1,MyForcedClass2].concat(valueClasses)).
>
> Robert
>
> On Dec 3, 3:21 pm, karfau <co...@karfau.de> wrote:
>> Well maybe just forget about the question about the optional
>> parameters in constructors...
>>
>> One way could be to force two parameters for the functions and allow
>> additional ones by using the following syntax in an extending Class:
>>
>> class MySignal{
>> public function MySignal(...valueClasses){
>> super([MyForcedClass1,MyForcedClass2].concat(valueClasses));
>> }}
>>
>> if ever nessesary.
>>
>> So another wow, looking forward to use this, as I always felt creepy
>> with all those const Strings all over the place that needed to be
>> somehow unique.
>>
>> karfau
>