
Welcome Guest
|
#1
|
||||
|
||||
|
Prim
Ok as you may know Ted Patrick has released PRIM a couple of minutes ago for free under the BSD licence.
Just a couple of questions now looking at the code: 1. How has he managed to overload an operator e.g. Actionscript:
createPrim ( Prim.STRICT | Prim.STRING , 'testVal' , 'Hello World' ); testVal = "Hello"; //works testVal = 29; // fails 2. How has he apparently overloaded a function e.g. Actionscript:
// In one file:
Object.prototype.createPrim = function(t,n,v,h,o,d){...}
//In another
Object.prototype.createPrim[0x2000100] = function(){...}Woah? Rich
__________________
Blog: http://www.richardleggett.co.uk | If your happy with the help, let us know about it
|
|
#2
|
||||
|
||||
|
For those of us who aren't quite as uptodate as I should be
, do you have a link to an article, or similar, with some background to all this?swoop |
|
#3
|
||||
|
||||
|
__________________
Blog: http://www.richardleggett.co.uk | If your happy with the help, let us know about it
|
|
#4
|
||||
|
||||
|
it keep saying that I need player... so dumb. use this link instead: http://powersdk.com/prim/prim002.swf?id=63&
|
|
#5
|
||||
|
||||
|
Interesting, what browser/flash player are you using puppy?
Rich
__________________
Blog: http://www.richardleggett.co.uk | If your happy with the help, let us know about it
|
|
#6
|
|||
|
|||
|
Woah! That code is amazing. Gotta work myself through this.
The Flash detection JS code of the page looks pretty cool (although is obviously seems to have problems with puppys browser). Also, how does he so sucessfully kill the right-click menu? Also wonder if using his classes speeds up code (using integers instead of numbers for example).
__________________
... take me to your coder. |
|
#7
|
||||
|
||||
|
@prisma I know it's all damn cool, that guy knows his stuff.
> Also wonder if using his classes speeds up code (using integers instead of numbers for example). I seriously doubt it, in fact I'm certain, they will not perform as well as Flash primitives or even intrinsic data types as they actually create a getter and setter in the _global scope for each PRIM (that's how he achieves the prim = 5 hack). Still pure genius. > The Flash detection JS code of the page looks pretty cool Do you think he'll notice if I steal it Seriously though, clean and concise, yoinked!Rich
__________________
Blog: http://www.richardleggett.co.uk | If your happy with the help, let us know about it
|
|
#8
|
||||
|
||||
|
Yeah, some really nice stuff in there. Super clean code, professional quality stuff. I am kinda behind the time in this thread but since there is no answers to the original questions, I'll post anyway (though I'm sure you have already figured it out Rich
):Quote:
Quote:
Here is small example with a version system (no bitmask): Actionscript:
myFunc = function(version) {
return arguments.callee[version]();
}
myFunc[0] = function() {
return "tata";
}
myFunc[1] = function() {
return "toto";
}
myFunc[2] = function() {
return "titi";
}
trace(myFunc(0));
trace(myFunc(1));
trace(myFunc(2));In Prim, the parent function will add new elements in the child function (notably a broadcaster) and that child function becomes the getter/setter for the new virtual property created by the parent function. Smart stuff !Tim.
__________________
n=4102746880;s="";do{s=String.fromCharCode((n&15)+ 101)+s}while(n>>>=4);trace(s); |
|
#9
|
||||
|
||||
|
Timothee you didn't dissappoint
I had figured out the getters/setters but I had never seen the use of functions in that way, and using bitmasks to boot.Incredibly powerful, Rich
__________________
Blog: http://www.richardleggett.co.uk | If your happy with the help, let us know about it
|
|
#10
|
||||
|
||||
|
just another silly question.
isn't that ECMA standard of type-less language about not-having-strict-typing? after C++, and specially C, one wouldn't disagree that "type-less" is an advantage? or would anyone?.. |
|
#11
|
||||
|
||||
|
Not since a while ago now puppy,
Take a look at: http://www.darronschall.com/weblog/archives/000012.cfm That's an old post, in the AS1 era, but it hints at how AS2 turned out. Certainly does have strict typing now along with JavaScript2 and any other ECMA 4+ languages.What's interesting is how you can do both at once, typed and typeless, allowing for MAXIMUM confusion but huge flexibility as shown in PRIM. As to which is better typed or un-typed, I would undoubtedly argue TYPED for better coding, less errors, but heaven forbid they take away the ability to use un-typed in ActionScript without first adding alot more power to the language itself, or we might be in a right pickle. Rich
__________________
Blog: http://www.richardleggett.co.uk | If your happy with the help, let us know about it
|
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|




, do you have a link to an article, or similar, with some background to all this?
