Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
objective c quirk
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Shaun Pryszlak  
View profile  
 More options Jan 16, 5:45 am
From: Shaun Pryszlak <thirdpr...@gmail.com>
Date: Mon, 16 Jan 2012 10:45:08 +0000
Local: Mon, Jan 16 2012 5:45 am
Subject: objective c quirk

Hi all

I have noticed a major quirk in Objective C a couple of times now but
haven't seen it reported anywhere else.  Is it just me?

You have two classes and both contain a private variable with the same
name.  Class A has an int called _score and class B has an object called
_score. Now I have just had an instance where class B declares this object,
calls the alloc/init methods but what is returned is an int.  This of
course gets my app very confused.  Surely with encapsulation, you shouldn't
have to worry about using the same variable name twice.  Is this a
"feature" of OC and if so, how can i turn it off?

Shaun


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Ross  
View profile  
 More options Jan 16, 5:46 am
From: Chris Ross <darkrock.ch...@googlemail.com>
Date: Mon, 16 Jan 2012 10:46:57 +0000
Local: Mon, Jan 16 2012 5:46 am
Subject: Re: objective c quirk

Presumably you also mean that B inherits from A?

On 16 Jan 2012, at 10:45, Shaun Pryszlak wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shaun Pryszlak  
View profile  
 More options Jan 16, 6:11 am
From: Shaun Pryszlak <thirdpr...@gmail.com>
Date: Mon, 16 Jan 2012 11:11:29 +0000
Local: Mon, Jan 16 2012 6:11 am
Subject: Re: objective c quirk

Nope, both are separate classes with _score declared locally.

Shaun

On 16 January 2012 10:46, Chris Ross <darkrock.ch...@googlemail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nick Kuh  
View profile  
 More options Jan 16, 6:15 am
From: Nick Kuh <nick....@gmail.com>
Date: Mon, 16 Jan 2012 11:15:25 +0000
Local: Mon, Jan 16 2012 6:15 am
Subject: Re: objective c quirk
Hi Shaun

Perhaps you can share some code that demonstrates the problem as I'd also assumed you must be subclassing?

Nick

On 16 Jan 2012, at 11:11, Shaun Pryszlak wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Ledger  
View profile  
 More options Jan 16, 6:16 am
From: Paul Ledger <diyguyp...@gmail.com>
Date: Mon, 16 Jan 2012 11:16:11 +0000
Local: Mon, Jan 16 2012 6:16 am
Subject: Re: objective c quirk

Not sure if I'm understanding this, but depending on what you are doing
with the object you will get a number back, i.e. the objects Id?

On 16 January 2012 11:11, Shaun Pryszlak <thirdpr...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Ross  
View profile  
 More options Jan 16, 6:17 am
From: Chris Ross <darkrock.ch...@googlemail.com>
Date: Mon, 16 Jan 2012 11:17:18 +0000
Local: Mon, Jan 16 2012 6:17 am
Subject: Re: objective c quirk

So to clarify:

What "returns an int" ?

Can you provide an example of this where it happens?

[I just put together an example and can't see that it is going wrong]

Chris

On 16 Jan 2012, at 11:11, Shaun Pryszlak wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shaun Pryszlak  
View profile  
 More options Jan 16, 6:53 am
From: Shaun Pryszlak <thirdpr...@gmail.com>
Date: Mon, 16 Jan 2012 11:53:39 +0000
Local: Mon, Jan 16 2012 6:53 am
Subject: Re: objective c quirk

Hi

I have fixed it now but it was the second time it had come up, so I just
wondered if anyone else had noticed it.  It is probably just some subtle
scoping thing that I am not aware of.  Never mind.

We got a meeting this month?  I might make a new years resolution to try
and attend at least one.

Shaun

On 16 January 2012 11:17, Chris Ross <darkrock.ch...@googlemail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam Martin  
View profile  
 More options Jan 16, 7:42 am
From: Adam Martin <adam.m.s.mar...@gmail.com>
Date: Mon, 16 Jan 2012 12:42:58 +0000
Local: Mon, Jan 16 2012 7:42 am
Subject: Re: objective c quirk
How/where are you declaring this? And which compiler are you using (old or new)?

Obj-C only recently got upgraded from "a bunch of hand-written scripts
that convert it to C code, which is then sent to a C compiler".

Obj-C will let you declare almost anything almost anywhere, but with
the Xcode 3.x compiler, small quirks in those scripts could end up
generating C code that didn't really do what it was supposed to.

In particular, when I started with iPhone, you could get some pretty
bad screw-ups because the scripts had a poor naming scheme, and would
sometimes convert two independently scoped obj-c things to exactly the
same name in C - and C has no namespacing, so that's guaranteed to
blow up in your face.

IF you're using the old compiler, I'd assume you're seeing another one of those.

If you're using the new compiler, well ... it still has some bugs,
although I haven't seen any problems with scope / global names so far.

On 16 January 2012 10:45, Shaun Pryszlak <thirdpr...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »