DTS needs to provide code-level support for AppleScriptObjC developers

Originator:jcwelch
Number:rdar://7256673 Date Originated:27 Sept 2009
Status:Open Resolved:
Product:Developer Tools Product Version:10.6/all builds
Classification:Enhancement Request Reproducible:Always
 
27-Sep-2009 12:41 PM John Welch:
Currently, AppleScriptObjC is not supported by DTS. As a reference, the response to incident 83667394:

"Thank you for contacting Apple Developer Technical Support (DTS).  DTS does not provide code-level support for AppleScript still. "

DTS not providing code-level support for Applescript in the past was, while disappointing, understandable, as the way the language interacted with the OS did not match the way other languages did. Even AppleScript Studio did not do much to correct this, and to really use most Cocoa features and classes, devs had to use Obj-C anyway.

However, with AppleScriptObjC, AppleScript now more closely maps, in AppleScriptObjC applications, to the way that other languages, (Objc-C, Python, Ruby) interact with Cocoa frameworks, and so a change in support is required. As an example, the example AppKit  application, DotView. The code to draw the dot in the Objective-C version:

- (void)drawRect:(NSRect)rect {
    NSRect dotRect;

    [[NSColor whiteColor] set];
    NSRectFill([self bounds]);   // Equiv to [[NSBezierPath bezierPathWithRect:[self bounds]] fill]

    dotRect.origin.x = center.x - radius;
    dotRect.origin.y = center.y - radius;
    dotRect.size.width  = 2 * radius;
    dotRect.size.height = 2 * radius;
    
    [color set];
    [[NSBezierPath bezierPathWithOvalInRect:dotRect] fill];
}

	on drawRect_(rect)
		NSColor's whiteColor()'s |set|()
		tell NSBezierPath's bezierPathWithRect_(my |bounds|()) to fill()
		
		set origin to {(my |center|'s x) - (my radius), (my |center|'s y) - (my radius)}
		set |size| to {2 * (my radius), 2 * (my radius)}
		
		my |color|'s |set|()
		tell NSBezierPath's bezierPathWithOvalInRect_({origin, |size|}) to fill()
	end drawRect_

There are of course language differences, but allowing for syntactical differences, AppleScriptObjC is now doing things "the cocoa way"

Another example, the code for moving the dot on mouseUp:

- (void)mouseUp:(NSEvent *)event {
    NSPoint eventLocation = [event locationInWindow];
    center = [self convertPoint:eventLocation fromView:nil];
    [self setNeedsDisplay:YES];
}

	on mouseUp_(|event|)
		set eventLocation to |event|'s locationInWindow()
		set my |center| to my convertPoint_fromView_(eventLocation, missing value)
		tell me to setNeedsDisplay_(true)
	end mouseUp_

The differences between the two implementations are now reduced to syntactical differences. In fact, the differences are now minor enough so that AppleScriptObjC devs can actually use the standard Cocoa documentation and sample code in a useful manner. 

In addition, with AppleScriptObjC, AppleScript devs now have access to all the Cocoa frameworks. Core Data, the calendar store, core graphics, etc. This is an enormous increase in power, and as AppleScriptObjC devs start moving into the larger Cocoa world, they are going to start doing things that aren't just a GUI slapped on to a script, but real applications that are doing really hard things. 

That requires code-level support. Yes, mailing lists and the community are fantastic resources, but that is not going to be enough for AppleScriptObjC. We're going to need proper engineering support, even at the code level. 

Because of this, the long-standing DTS lockout of AppleScript needs to change, specifically for AppleScriptObjC. It needs the same level of support as Obj-C, Python, Ruby, and other languages that Apple supports in Xcode. (full projects attached.)


'DotViewASOC.zip' was successfully uploaded

27-Sep-2009 12:43 PM John Welch:
'DotViewObjC.zip' was successfully uploaded

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!