Re: NSLog a No-Op Probably Explained
Re: NSLog a No-Op Probably Explained
- Subject: Re: NSLog a No-Op Probably Explained
- From: Ken Thomases <email@hidden>
- Date: Sun, 20 Dec 2009 03:42:24 -0600
On Dec 20, 2009, at 2:51 AM, Tom Davie wrote:
On Sun, Dec 20, 2009 at 5:18 AM, Thomas Wetmore <email@hidden>
wrote:
It appears that NSLog does not allow "recursive" calls, that is, if
you
call NSLog and the evaluation of one of its arguments ALSO causes
calls
NSLog, the deeper calls are essentially ignored. I don't know how
to prove
this definitively but it is the case that the deeper calls to NSLog
do
indeed call dyld_stub_NSLog, but instead of dyld_stub_NSLog doing
anything
real, it returns immediately.
(I had NSLog calls inside a class's description method; these calls
did not
work when the description method was called within the context of
another
NSLog. However, when the description method is called outside the
context of
an NSLog call the NSlog calls in the description method work fine.)
I'm sorry, but you're explanation does not make sense in a C like
language
setting.
A C like language uses eval/apply semantics – i.e. a function's
arguments
are evaluated before the function is applied. With this in mind, the
arguments to NSLog are evaluated in an environment that knows
nothing about
them being arguments, let alone what they're arguments to.
You're misunderstanding when the -description method is called. When
you use "%@" in a format string, NSLog invokes -description on the
corresponding argument. So, it is definitely possible for NSLog to
get invoked recursively in the manner the OP described.
Regards,
Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden