Re: ASObjC alloc and object creation
Re: ASObjC alloc and object creation
- Subject: Re: ASObjC alloc and object creation
- From: Shane Stanley <email@hidden>
- Date: Mon, 29 Jan 2018 00:02:32 +1100
On 28 Jan 2018, at 11:45 pm, Jean-Christophe Helary
<email@hidden> wrote:
>
> Why can I create an XML node without alloc ?
It's what's known as a convenience method. You're actually making a particular
subclass of NSXMLNode, an NSXMLElement.
You could have used:
set projectRoot to current application's NSXMLElement's alloc()'s
initWithName:"omegat"
But convenience methods are common, if not following any particular logic of
when and where they're provided. Something like "stringWithString:" instead of
"alloc()'s initWithString:" is a common example.
In applications written using manual memory management, objects created by
init… methods have to be managed differently.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden