Ticket #25 (new task)

Opened 2 years ago

Last modified 10 months ago

com.bigspaceship.utils.Delegate is under GPL, which is incompatible with BSD license

Reported by: anonymous Assigned to:
Priority: major Milestone:
Keywords: Cc:

Description

Probably should redo the whole class. Shouldn't be hard.

Attachments

Delegate.as (0.6 kB) - added by anonymous on 08/14/07 15:09:01.
An alternate Delegate.as might work something like this.

Change History

04/11/07 18:47:48 changed by migurski

  • summary changed from com.bigspaceship.utils.Delegate is under GLP, which is incompatible with BSD license to com.bigspaceship.utils.Delegate is under GPL, which is incompatible with BSD license.
  • milestone set to 1.0 Final.

07/06/07 12:31:04 changed by anonymous

07/08/07 01:32:01 changed by anonymous

08/03/07 00:53:06 changed by anonymous

08/03/07 02:58:36 changed by anonymous

08/06/07 01:32:40 changed by anonymous

08/06/07 06:39:32 changed by anonymous

08/14/07 15:09:01 changed by anonymous

  • attachment Delegate.as added.

An alternate Delegate.as might work something like this.

08/14/07 15:12:21 changed by anonymous

Code can be tested as follows:

import Delegate;

var scope = new Object();
var test = Delegate.create(
	scope, 
	function(){ 
		trace(this + ',' + arguments); 
	}, 
	100, 
	256
);

test();

var fn = function() { trace("hello, world!") } 
var d  = new Delegate(fn);
var f  = (d.createDelegate(this));
f();

08/14/07 15:19:17 changed by anonymous

In fact, couldn't you just do this?

class Delegate extends Object {

	private var _source:Function;
	
	static function create( $scope:Object, $source:Function ):Function { var f;
	
		var args: Array = arguments.slice( 2 );
		
		return function() {
			$source.apply( $scope, args );
		};
	}
	
	function Delegate( $fn:Function ) {
		_source = $fn;
	}
	
	function createDelegate( $obj:Object ):Function {
		return create( $obj, _source )
	}
	
}

08/17/07 07:56:07 changed by anonymous

01/25/08 21:23:09 changed by migurski

  • milestone deleted.