NSTaggedPointerString?

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?

I found this article on NSTaggedPointerString’s.

https://www.mikeash.com/pyblog/friday-qa-2015-07-31-tagged-pointer-strings.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

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.