ItemCollection.exists is not working

4 views
Skip to first unread message

Andy Li

unread,
Jul 18, 2010, 10:09:09 PM7/18/10
to haxetacy
ItemCollection.exists ( http://code.google.com/p/haxetacy/source/browse/ASP__.hx#200
) uses a function _exists defined in __init__, but since __init__ is
compiled and placed in a {} block, so actually _exists is not exist
globally, so the exists method will fail in runtime.

Here below will work:

class ItemCollectionHelper {
static public function
exists(c:ItemCollection<Dynamic>,key:String):Bool {
return c.item(key)!=c.item(' ~DUMMY`');
}
}

extern class ItemCollection<T> extends AssociativeCollection<T> {
inline function exists(key:String):Bool {
return ItemCollectionHelper.exists(this, key);
}
}

Michiel Crefcoeur

unread,
Jul 19, 2010, 4:39:14 AM7/19/10
to haxe...@googlegroups.com
I've been moving some things around and haven't checked everything yet, sorry for that.
However, this is supposed to work because there is no var keyword in front of _exists so it should be a global variable. 
Will check it today.

2010/7/19 Andy Li <an...@onthewings.net>

Michiel Crefcoeur

unread,
Jul 19, 2010, 5:09:38 AM7/19/10
to haxe...@googlegroups.com
I don't know what I was thinking! :-)
but it's fixed, thanks again.


2010/7/19 Michiel Crefcoeur <mpc...@gmail.com>

Andy Li

unread,
Jul 19, 2010, 6:30:51 AM7/19/10
to haxe...@googlegroups.com
Thanks for the quick response! Will test it tomorrow :)

Michiel Crefcoeur

unread,
Jul 19, 2010, 9:41:00 AM7/19/10
to haxe...@googlegroups.com
I suddenly realise that my project has one haxelib dependency which happens to be your jsmin lib!
:-)

2010/7/19 Andy Li <an...@onthewings.net>

Andy Li

unread,
Jul 19, 2010, 9:20:42 PM7/19/10
to haxe...@googlegroups.com
haha, I know. That's great that I wrote something that useful for you and you use it in a project that useful for me. What a wonderful open source experience :)
BTW, feel free to tell me if you find anything that can be improved for jsmin.

Michiel Crefcoeur

unread,
Jul 20, 2010, 5:32:30 AM7/20/10
to haxe...@googlegroups.com
In haxetacy a jsmin call is done by using com.crockford.JSMin.minify()
I do some output patching there, the comments in that class might be of interest to you.

2010/7/20 Andy Li <an...@onthewings.net>
Reply all
Reply to author
Forward
0 new messages