Tuesday, April 23, 2019

#1 2015-10-02 09:20:59 am

Mark Munro
Registered: 2008-01-16
Posts: 175


I have a text field with its value bound to a property.

When the value of the text field has no spaces, the class of the property is


property textComputerAdmin : ""

log my textComputerAdmin
-- Result = "Admin"

log class of my textComputerAdmin
-- Result = <NSAppleEventDescriptor: 'ctxt'>

When a space is present in the text field, suddenly the class of the property is NSTaggedPointerString.


property textComputerAdmin : ""

log my textComputerAdmin
-- Result = "Mark Munro"

log class of textComputerAdmin
-- Result = NSTaggedPointerString

When I try using this value, even just trying to set it "as text" as I get errors like:

Can’t make «class ocid» id «data optr00000000A5A32C389F2C6802» into type list, record or text.

I see no entry in Xcode's documentation for NSTaggedPointerString and web searches are fruitless. Does anyone know what is going on?



#2 2015-10-02 12:31:48 pm

Mark FX
From:: UK
Registered: 2011-08-12
Posts: 94

Re: NSTaggedPointerString?

I found this article on NSTaggedPointerString's.

https://www.mikeash.com/pyblog/friday-q … rings.html

The article is very in depth on the subject, but it seems they where introduced in OS X 10.10 for memory and speed performances.
They also seem to be related to small sized String's, and String's stored in Array's.
Sorry I can't help you any more on the subject, as I hadn't heard of them myself until reading your post.

Regards Mark



#3 2015-10-02 05:51:20 pm

Shane Stanley
From:: Australia
Registered: 2002-12-07
Posts: 5626

Re: NSTaggedPointerString?

Whatever your problem is, I'd be surprised if it's related to NSTaggedPointerString. You don't show how you are setting the values, but getting an AppleEventDescriptor in one case and an NSString in another suggests your code is a bit more complex.

Here's a simple snippet I'm running in ASObjC Explorer using BridgePlus to make sure I get a tagged pointer:


use framework "Foundation"
use script "BridgePlus"

set x to Cocoaify "Mark Munro"
x's |class|()
x as text

And here's what's logged:


0000.001 [8] set x to Cocoaify "Mark Munro"
-->    (NSString) "Mark Munro"
0000.001 [9] x's |class|()
-->    (Class) NSTaggedPointerString
0000.001 [10] x as text
-->    "Mark Munro"

So it seems to be coercing fine, as an NSString subclass should. I'm still running 10.11GM, but I doubt that matters.

Shane Stanley <sstanley@myriad-com.com.au>



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)