Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.objective-c > #157 > unrolled thread

resource management and constructors question

Started byAutomn <automn@willow.org>
First post2015-02-10 10:58 +0000
Last post2015-02-10 19:34 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.objective-c


Contents

  resource management and constructors question Automn <automn@willow.org> - 2015-02-10 10:58 +0000
    Re: resource management and constructors question Doc O'Leary  <droleary@2usenet2014.subsume.com> - 2015-02-10 15:31 +0000
      Re: resource management and constructors question Automn <automn@willow.org> - 2015-02-10 19:34 +0000

#157 — resource management and constructors question

FromAutomn <automn@willow.org>
Date2015-02-10 10:58 +0000
Subjectresource management and constructors question
Message-ID<slrnmdjp8g.88b.automn@sigtrans.org>
Hello,

I have a bit of experience in Smalltalk and Objective-C but someone told me
something I do not understand :

Why cannot you overload the -new method for construction ? It does not 
operate on classes but on instances AFAIK so I can retain data in it but 
apparently no one wants to have a clean interfaced -new overloaded method ?

I do not use +new as a class method, I want to use -new.

Best Reagrds,
Automn

[toc] | [next] | [standalone]


#158

FromDoc O'Leary <droleary@2usenet2014.subsume.com>
Date2015-02-10 15:31 +0000
Message-ID<mbd893$a2b$1@dont-email.me>
In reply to#157
For your reference, records indicate that 
Automn <automn@willow.org> wrote:

> Hello,
> 
> I have a bit of experience in Smalltalk and Objective-C but someone told me
> something I do not understand :
> 
> Why cannot you overload the -new method for construction ? It does not 
> operate on classes but on instances AFAIK so I can retain data in it but 
> apparently no one wants to have a clean interfaced -new overloaded method ?

You cannot overload -new because it doesn’t exist (at least not in the
common Object or NSObject hierarchies).  There is +new and there is -init.
I have no idea what you want a -new method to do, but you’re welcome to
use it.  Be sure to document it extremely well if you share your code,
because it could lead to confusion.

-- 
"Also . . . I can kill you with my brain."
River Tam, Trash, Firefly

[toc] | [prev] | [next] | [standalone]


#159

FromAutomn <automn@willow.org>
Date2015-02-10 19:34 +0000
Message-ID<slrnmdkngq.76d.automn@sigtrans.org>
In reply to#158
On 2015-02-10, Doc O'Leary <droleary@2usenet2014.subsume.com> wrote:
>
> You cannot overload -new because it doesn’t exist (at least not in the
> common Object or NSObject hierarchies).  There is +new and there is -init.
> I have no idea what you want a -new method to do, but you’re welcome to
> use it.  Be sure to document it extremely well if you share your code,
> because it could lead to confusion.
>

OK, I understand, it's the call of the overload that is the problem, not
the interface, nor the implementation.

Thanks,
Automn

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.objective-c


csiph-web