| Latest |Kites |Pictures |Programming |Life |
![]() [filed under Programming]Why LISP is better than me ![]() I wish I could do this in any of the languages I use: porting-perls-qq-to-common-lisp. A few simple lines of code and you have a new language operator qq. Ugh. This would be soooo cool. I had a problem the other day where I had an object with various members, some of which I wanted to have the extra attribute 'merge-able' some how. This is how it looked: class moo{ Then in a method inside moo: foreach( prop in this ) and what I wanted was to somehow 'hide' height from the iterator... I guess there are two ways of doing this, first override the 'iterator' or 'foreach' operator. This is impossible in ActionScript. Or second add an attribute to each property, kinda like: class moo{ But there's no way to do this and no way to extend the language to make it work. It is most irritating. I have 40 or 50 objects and I iterate over all of them. And I have this problem in one or two of them.... argh! How annoying. The only thing I can think of is to have an iterable properties list, then: foreach( prop in this.iterable_properties_list() ) But this means keeping my object definition and iterable_properties_list method in sync (for over 40 different objects.) Filth. I guess I could hack it using PHPs naming scheme, anything that starts with an underscore is 'special'. Then I could do: foreach( prop in this ) Comments [15th of Aug, 2008 @ 08:49 PM] Chris McFadyen said: You mentioned ActionScript, though your code looks like a mix of AS and PHP... For AS2, you can use ASSetPropFlags() to make properties non-enumerable, and in AS3 you can use Object.setPropertyIsEnumerable(). |
|
Parse error: syntax error, unexpected $end in /home/teethgrinduk/public_html/bbclone/var/access.php on line 368 |