Skip to content

Instantly share code, notes, and snippets.

@skial
Created November 8, 2013 15:24
Show Gist options
  • Save skial/7372563 to your computer and use it in GitHub Desktop.
Save skial/7372563 to your computer and use it in GitHub Desktop.
Abstract bug?
package ;
using Lambda;
class Main {
public static function main() {
var a = ['a', 'b', 'c'];
var m:MyArray = a;
if (m['a']) trace( m['a'] );
}
}
abstract MyArray(Array<String>) from Array<String> to Array<String> {
public function new(v:Array<String>) this = v;
@:arrayAccess public function exists(v:String):Bool return this.indexOf(v) > -1;
@:arrayAccess public function get(v:String):String return this[this.indexOf(v)];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment