Re: Language.string behavior (was Re: null values in XML)

2021-11-13 Thread Harbs
Fair enough. I guess we should examine how it’s being used. In my app I found 612 cases of Language.string being used. I should go though them and catalog when it’s being used. One that jumped out at me is: var qString:String = qualifiers.toXMLString(); compiles to: var /** @type {string} */

Re: Dictionary

2021-11-13 Thread Greg Dove
> ObjectMap has a forceEnumerable option in the constructor, so it can > automatically switch from WeakMap to Map if necessary (i.e. to use > ObjectMap.forEach). Yes, I know. But IMO that really doesn't save anything (probably including keystrokes) when porting, because you make this decision at c

Re: Dictionary

2021-11-13 Thread Edward Stangler
ObjectMap has a forceEnumerable option in the constructor, so it can automatically switch from WeakMap to Map if necessary (i.e. to use ObjectMap.forEach). On 11/13/2021 7:37 PM, Greg Dove wrote: > Fair enough. :) I prefer to do something different, but I take your point. > > IMO WeakMap is not

Re: Dictionary

2021-11-13 Thread Greg Dove
Fair enough. :) I prefer to do something different, but I take your point. IMO WeakMap is not that useful in js (which also applies to ObjectMap), compared to how a Dictionary with weak keys was useful in flash. It still has some usefulness, but not to the same degree, because if there is any iter

Re: Dictionary

2021-11-13 Thread Edward Stangler
ObjectMap hides the whole WeakMap vs. Map vs. Object / any stuff, so it just seems convenient, while still trying to be performant and reducing strong references. Worked well for XMLNotifier. On 11/13/2021 6:12 PM, Greg Dove wrote: > Using ObjectMap could be an option if you want both SWF and

Re: Dictionary

2021-11-13 Thread Greg Dove
Using ObjectMap could be an option if you want both SWF and JS code to run, but is not really warranted IMO if the main goal is to migrate away from SWF, because the api is the same as Map, and is indirect use of the Map - so why add the extra overhead? Also if you can avoid switching the original

Re: Dictionary

2021-11-13 Thread Edward Stangler
Why not use org.apache.royale.utils.ObjectMap? On 11/13/2021 3:24 PM, Greg Dove wrote: > Sure, if you want, Andrew. This is the way I do it currently, and in some > cases this has been done within the current framework code (e.g. in Crux > code there is some use of Map to replace Dictionary in

Re: Language.string behavior (was Re: null values in XML)

2021-11-13 Thread Edward Stangler
I think you're right. According to the AVM2 doc (avm2overview.pdf), for coerce_s ("Coerce a value to a string"): "If value is null or undefined, then stringvalue is set to null" and "This opcode is very similar to the convert_s opcode. The difference is that convert_s will convert a null or un

Re: Language.string behavior (was Re: null values in XML)

2021-11-13 Thread Edward Stangler
What I'm getting at: maybe it should return "null" instead of null. On 11/13/2021 1:24 PM, Harbs wrote: > Of course and JS works the same way. But Language.string is used for implicit > coercions where it might have an initial value of undefined. In that case, I > don’t think you’d usually wa

Re: DataGrid tab and select next column

2021-11-13 Thread Hugo Ferreira
Problem solved (for now). One entire day to do this but necessary. I confess that it's not the best code (many workarounds navigating to parents, etc ...) but at the end of the day, fulfill the requirements. The enter key moves to edit mode on the next line but with the same column position. The t

Re: Dictionary

2021-11-13 Thread Hugo Ferreira
It worked pretty well. No need to emulate the Dictionary. Thank you. Greg Dove escreveu no dia sábado, 13/11/2021 à(s) 20:45: > Hi Hugo, > > I might change this in the near future. But for now, here is the general > 'rule of thumb' that I use: > > If the instance only has string keys (or int/uin

Re: Language.string behavior (was Re: null values in XML)

2021-11-13 Thread Greg Dove
I am pretty sure Language.string is behaving correctly. Here's a very simple example of what you get in flash player. var something:* //undefined by default var str1:String = something; var str2:String = something as String; var str3:String = String(something); trace((str1===null),(str2===null)

Re: Dictionary

2021-11-13 Thread Greg Dove
Sure, if you want, Andrew. This is the way I do it currently, and in some cases this has been done within the current framework code (e.g. in Crux code there is some use of Map to replace Dictionary in js, iirc) I do expect to come up with an approach that works much closer to the original flash D

Re: Dictionary

2021-11-13 Thread Andrew Wetmore
Greg, can I throw that into documentation as a workaround? On Sat., Nov. 13, 2021, 4:45 p.m. Greg Dove, wrote: > Hi Hugo, > > I might change this in the near future. But for now, here is the general > 'rule of thumb' that I use: > > If the instance only has string keys (or int/uint/Number/Boolea

Re: Dictionary

2021-11-13 Thread Greg Dove
Hi Hugo, I might change this in the near future. But for now, here is the general 'rule of thumb' that I use: If the instance only has string keys (or int/uint/Number/Boolean keys should be ok too) then use a plain Object. All code can pretty much then remain unchanged. If it is using object ins

Dictionary

2021-11-13 Thread Hugo Ferreira
Hi, I see that there is no Dictionary on Royale, probably because there is a better method. What the approach in Royale for a Dictionary ?

Language.string behavior (was Re: null values in XML)

2021-11-13 Thread Harbs
Of course and JS works the same way. But Language.string is used for implicit coercions where it might have an initial value of undefined. In that case, I don’t think you’d usually want to be using “undefined”. You probably want “” instead. I don’t remember all the discussions we had around thi

Re: null values in XML

2021-11-13 Thread Harbs
Yes. It was supposed to be doing that, but some cases were missed. The change I made was necessary to properly return empty strings. I just made a new commit which does a better job of handling and preserving the undefined values. I also fixed an issue with setting null and undefined which was

Re: null values in XML

2021-11-13 Thread Harbs
Because empty strings use memory. > On Nov 12, 2021, at 8:19 PM, Edward Stangler wrote: > > > Why is XML.copy() not setting ""? > > > On 11/12/2021 4:05 AM, Harbs wrote: >> xml.toXMLString() is correct. >> >> >> >> I believe there’s two problems: >> >> 1. XML.toString() blindly returns _v

DataGrid tab and select next column

2021-11-13 Thread Hugo Ferreira
Hi, I have a Jewel DataGrid with an itemrenderer that supports editing and so far, so good. One click and I can edit exactly as I did in the past with Flex. Now for the next step I want to be able to navigate (and enter edit mode) to the next right field when I press "tab" key and I want to be ab