Re: Phix language
- Posted by petelomax Nov 30, 2011
- 2014 views
How do you handle a 'regular' sequence vs an 8-bit sequence? Like, say, concatenating one with the other?
Strings are "auto-expanded" when necessary. For example
s = {-5,0}&"ab" -- s is now {-5,0,'a','b'} s = "ab" & -5 -- s is now {'a','b',-5}
Internally, the compiler creates 8-bit strings when it sees double quotes and dword sequences when it sees curly braces.
Elsewhere, dword-sequences can be used in place of strings, eg
open_dll("kernel32.dll") open_dll({'k','e','r','n','e','l','3','2','.','d','l','l'})
behave the same though the later automatically does the same sort of "pack" that OpenEu must be doing.
The only real oddity is that prepend always yields a dword-sequence since otherwise prepend(string,char) would perform a complete copy to avoid non-dword aligned data, which gets a bit costly when you do it lots of times. But apart from explicitly testing it, you can use the result as if it was a string, so it doesn't really matter.
Regards,
Pete