I require an pointer to the value represented by an NSNumber.
...
I am using NSNumber instances in collections as keys.
i may not fully understand your question, but can you not just use
NSValue valueWithPointer as your collection keys?
or, if a number at all, the number matching the pointer
On 23 Feb 2014, at 13:15, Graham Cox graham@bigpond.com wrote:
Either that or a custom class would actually require very little effort -
probably less than the typing in this discussion so far anyway!
It actually takes a bit more effort to subclass NSNumber than it does to talk
On 23 Feb 2014, at 00:07, Graham Cox graham@bigpond.com wrote:
NSNumber's can be slippery buggers, in my experience.
Won’t disagree with that.
Why are you so determined that you must use NSNumber, rather than your own
class? You haven't adequately explained why that isn't a good
On 23 Feb 2014, at 8:30 pm, jonat...@mugginsoft.com wrote:
suppose I think that NSNumber actually is a good fit.
My usage model requires:
1. Configure an object with a numeric type: e.g.: @((int)5).
2. When I query an object subclass with getValue: I want to receive back an
instance of
On 23 Feb 2014, at 8:30 pm, jonat...@mugginsoft.com wrote:
Therefore the encoded class of the numeric key is essential.
Another solution would be just to use a string, with some encoding scheme of
your own device, e.g. append a type code to the constant. Category methods on
NSString would
On Feb 23, 2014, at 3:30 AM, jonat...@mugginsoft.com wrote:
3. For any given object subclass (of which there may be many) I want
-objCType to be constant.
I think that NSNumber does all of the above. Ken believes that 3. is in doubt.
If this proves to be the case then I will have to go
On 23 Feb 2014, at 8:30 pm, jonat...@mugginsoft.com wrote:
This dict, when instantiated, will contain 1 key value pair.
NSDictionary *dict = @{ @((int)1): @val 1, @((float)1): @val 2 };
However, this C# DictionaryTKey, TValue unit test object will contain two,
Would an NSNumber subclass be out of the question?
Just store that original type in your own retrievable way?
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the
On 23 Feb 2014, at 10:05, Graham Cox graham@bigpond.com wrote:
You might find it happens to work today but it is not contracted to do so
I agree that there is some uncertainty going forward.
Part of the issue I think is in the nature of class clusters.
We rely on the behaviour of an
On 23 Feb 2014, at 11:08 pm, jonat...@mugginsoft.com wrote:
1(int) and 1(float) can be represented by the same NSNumber object perfectly
legally.
Is that true?
I said can be, not is. Certainly my observation in the past was that
NSNumber stored, as an int, a float that could be represented
On Feb 23, 2014, at 4:08 AM, jonat...@mugginsoft.com wrote:
1(int) and 1(float) can be represented by the same NSNumber object perfectly
legally.
Is that true?
Yes. As far as NSNumber is concerned, they are equal. They are also both
equal to @(YES) which is initialized with a BOOL. Once a
On Feb 22, 2014, at 1:28 PM, jonat...@mugginsoft.com wrote:
On 22 Feb 2014, at 15:32, Ken Thomases k...@codeweavers.com wrote:
NSDecimalNumber can represent values that are outside of the range of
doubles. So, _some_ NSDecimalNumber instances _may_ return d for double,
but others
On 23 Feb 2014, at 14:15, Graham Cox graham@bigpond.com wrote:
On 23 Feb 2014, at 11:08 pm, jonat...@mugginsoft.com wrote:
1(int) and 1(float) can be represented by the same NSNumber object
perfectly legally.
Is that true?
I said can be, not is. Certainly my observation in the past
On Feb 22, 2014, at 1:44 AM, jonat...@mugginsoft.com wrote:
On 22 Feb 2014, at 00:12, Ken Thomases k...@codeweavers.com wrote:
On Feb 21, 2014, at 3:17 PM, jonat...@mugginsoft.com wrote:
So I want to be able to send the same message to any class and get an
appropriate void* pointer.
Ken is right about the internal representation of NSNumber not being something
you can count on (as it is a class cluster). You should be able to count on
the format of the data returned from its methods though (e.g. -integerValue,
-floatValue).
Out of curiosity, are there any constraints on
On 22 Feb 2014, at 08:32, Ken Thomases k...@codeweavers.com wrote:
There's no one representation of an NSNumber's content.
I think that this is the foundation of things.
What there is is a reported representation as given by -objCType.
The docs say, as I am sure you know:
“
NSNumber
objCType
On Feb 22, 2014, at 6:58 AM, jonat...@mugginsoft.com wrote:
Now I don’t care know how NSNumber persists its value nor with what type it
was initialised. What I do care about in this case is what -objCType returns.
If I create a NSNumber like so:
NSNumber *n = @((int)5);
Then [n
On 22 Feb 2014, at 14:27, Jonathan Hull jh...@gbis.com wrote:
I think the main objection everyone has is that they believe (as did I) that
-getValue: is actually returning the internal representation of the object.
That is a very pertinent point that we haven’t mentioned.
-getValue:
On Feb 22, 2014, at 9:33 AM, jonat...@mugginsoft.com wrote:
On 22 Feb 2014, at 14:27, Jonathan Hull jh...@gbis.com wrote:
I think the main objection everyone has is that they believe (as did I) that
-getValue: is actually returning the internal representation of the object.
That is a
But there's already a fully functional ObjC-C# bridge in Mono, isn’t there? I
know that’s what MonoTouch for iOS is based on. Doesn’t it already handle
bridging of NSDictionaries to C# Maps?
—Jens
___
Cocoa-dev mailing list
On Feb 22, 2014, at 9:43 AM, Ken Thomases wrote:
On Feb 22, 2014, at 9:33 AM, jonat...@mugginsoft.com wrote:
-getValue: populates a pointer to a type matching -objCType.
But there's no guarantee about what that type is. There's no guarantee that
it's a scalar rather than a structure,
On 22 Feb 2014, at 16:55, Jens Alfke j...@mooseyard.com wrote:
But there's already a fully functional ObjC-C# bridge in Mono, isn’t there?
I know that’s what MonoTouch for iOS is based on. Doesn’t it already handle
bridging of NSDictionaries to C# Maps?
The MonoTouch bindings are from C#
NSDecimal is a structure with associated C-level functions that could
theoretically work with the not-yet-supported floating point decimal types
in LLVM that were in later versions of GCC whereas NSDecimalNumber is an
Objective C class subclassed from NSNumber that provides NSDecimal
On 22 Feb 2014, at 15:32, Ken Thomases k...@codeweavers.com wrote:
NSDecimalNumber can represent values that are outside of the range of
doubles. So, _some_ NSDecimalNumber instances _may_ return d for double,
but others definitely won't.
I don’t think so.
It is possible that this
On 22 Feb 2014, at 11:58 pm, jonat...@mugginsoft.com wrote:
There's no one representation of an NSNumber's content.
I think that this is the foundation of things.
What there is is a reported representation as given by -objCType.
NSNumber's can be slippery buggers, in my experience.
Why
I require an pointer to the value represented by an NSNumber.
No interior pointer exists as the class is immutable.
My best attempt, a category that shadows the represented value, is as follows
though I am wondering if I have missed a trick somewhere.
NSNumber uses tagged pointers and my unit
On 21 Feb 2014, at 6:12 AM, jonat...@mugginsoft.com wrote:
I require an pointer to the value represented by an NSNumber.
(Assuming “value represented” means @1 - 1, @HUGE - HUGE.)
No interior pointer exists as the class is immutable.
Immutability isn’t the point. The point is that the class
On Feb 21, 2014, at 3:17 PM, jonat...@mugginsoft.com wrote:
I have an NSNumber containing 5.
The NSNumber instance is a key in a dictionary collection.
In order to obtain the value I need to pass a pointer to a memory location
containing 5 to Mono.
However not all keys in the dictionary
On 22 Feb 2014, at 00:12, Ken Thomases k...@codeweavers.com wrote:
On Feb 21, 2014, at 3:17 PM, jonat...@mugginsoft.com wrote:
So I want to be able to send the same message to any class and get an
appropriate void* pointer.
There's no one representation of its content, so there's no way
29 matches
Mail list logo