Re: How do you receive a BOOL from a method returning BOOL
Re: How do you receive a BOOL from a method returning BOOL
- Subject: Re: How do you receive a BOOL from a method returning BOOL
- From: "BK [address used for mailing lists only]" <email@hidden>
- Date: Sun, 19 Dec 2004 14:30:22 +0900
Hi Ricky,
thanks a lot for your assistance.
On 19 Dec 2004, at 0:52, Ricky Sharp wrote:
return [res is10digitNANPA:[aString substringFromIndex:index]];
What type is 'res' here?
BOOL
res = [res is10digitNANPA:[aString substringFromIndex:index]];
NSLog(@"res: %@", res);
return res;
From the looks here, are you attempting to send the is10digitNANPA:
message to your local variable 'res' which is of type BOOL?
Not intentionally. What I was trying to achieve was returning the
resulting BOOL value back to AppleScript.
something along the lines of ...
<pseudocode>
return (result returned by "is10digitNANPA:[aString
substringFromIndex:index]]");
</pseudocode>
If so, it's probably the case where res is initialized to a value of 0
(NULL). Sending a message to NULL then results in an assignment of
NULL to res.
Introducing 'res' was just a debugging measure to try to see what's
going on. To be honest, I didn't even expect this to work. I was merely
messing around using the good old trial and error approach ;-)
[BOOL someMethodReturningBOOL];
doesn't work because BOOL is not a a class.
Hmm. I think you should read up on some of the basics.
I have only been coding Objective-C for about 2 days. The last time I
did any serious programming was in VAX-BLISS to bootstrap a Modula-2
compiler on VMS version 4.5. The lingua franca at the time was COBOL
and OO was something confined to very nerdy research labs at half a
dozen or so Universities.
Since then my coding activities have been limited to Shell and
AppleScript scripting.
So, please pardon my apparent inexperience and foolishness.
I have read so much about Objective-C and Cocoa lately that further
reading will actually make things worse for me at this point. What I
need now is getting my hands dirty,
and at the point where I dig myself into a hole that I can't get out of
on my own I need some coaching, which you provided and for which I am
very grateful.
- (BOOL)foo
{
return [self someMethodReturningBOOL];
}
That's the one I was looking for. Thanks a lot.
Also thanks to all the others who have responded on and off list. I
really appreciate this. It seems like Cocoa comes bundled with a great
community spirit, I like it already!
rgds
bk
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden