| By Thomas Zang | Article Rating: |
|
| January 5, 2009 09:30 AM EST | Reads: |
3,133 |
At runtime, users can create a multidimensional array as follows:
arr = create int[4, 2 to 5]
which creates a two-dimensional integer array, with indexes of the two dimensions being 1 to 4 and 2 to 5.
Jag-array will be allowed to be declared. For example, int arr[][], which is a integer jag-array.
At runtime, users can create a jag-array as follow:
arr = create int[3][]
arr[1] = create int[5]
arr[2] = create int[20]
arr[3] = create int[10]
The first line creates an array with three elements, each of type int[] . The subsequent lines then initialize the three elements with references to individual array instances of varying lengths.
In .NET, a delegate type represents references to methods with a particular parameter list and return type. Delegates are similar to the concept of function pointers in some languages, such as C, but unlike function pointers, delegates are object-oriented and type-safe. In PB12, users will be able to make use of the .NET delegate type to cooperate with native PowerScript code.
The following example declares and uses a delegate type named Function in an imported .NET assembly.
.NET delegate declaration in C#:
delegate double Function(double x);
Consuming this delegate type in PowerScript:
public function double[] Apply ((double a[], Function f)
double result[]
for i = 0 to i < a.Length step 1
result[i] = f(a[i])
next
return result
end function
public function double Multiply(double x)
return x * factor;
end function
public function test()
double a[] = {1.0,2.0,3.0,4.0,5.0}
double doubles[] = Apply(a, Multiply)
end function
In PB12, the standard NVO will be able to inherit from a .NET class, which will override all virtual and abstract methods, properties, indexers, and events defined in the .NET base class and implemented interfaces.
Table 1 provides an overview of the kinds of members of a .NET class that can be exposed in PB.
This syntax of calling PowerScript functions and events will also be used to call the functions and events of .NET class as follow:
{ objectname.} { type } { calltype } { when } name ( { argumentlist } )
In .NET, generics are classes, structures, interfaces, and methods that have placeholders (type parameters) for one or more of the types that they store or use.
A generic collection class might use a type parameter as a placeholder for the type of objects that it stores; the type parameters appear as the types of its fields and the parameter types of its methods. A generic method might use its type parameter as the type of its return value or as the type of one of its formal parameters. In PB12, users will be able to consume .NET generic classes and methods, if they conform to generic CLS rules. But defining a generic type and overriding a generic method won't be supported.
Here's an example of consuming generic type in PB:
System.Collections.Generic.SortedList<string, integer> teams
teams = create System.Collections.Generic.SortedList<string, integer>
teams["DEV"] = 30
teams["QA"] = 25
In PB12, users will be able to define a global enum type; the new enum painter will be similar to Structure Painter as shown below.
To define a local enum, users will have to open the object painter that has a local enum painter attached.
The following kinds of PB objects will be able to define local enum: Custom Class, Standard Class, Custom Visual, Standard Visual, Window, and Menu.
In PB12, the following kinds of PB objects will be able to specify which namespace the object group belongs to and which namespaces the object group is using: Custom Class, Standard Class, Custom Visual, Standard Visual, Window, Menu, Structure, Function, Interface, and Enum.
There are two ways to identify a unique name. The first one is to use qualified names. That's a namespace name followed by the scope-resolution operator (.) and then the name of either a nested namespace or a group and the name of a member of a group. For example:
MyPkg.MyNestedPkg.w_main`cb_1
The second way is to use a using directive:
Using pkg1[.pkg2[.pkg3]...]
A using directive allows a named type to be referred to by a simple name that consists of a single identifier.
Currently in PB, a default constructor event is used to instantiate object. When a PB NVO object is created at runtime, an auto-generated oncreate event will be triggered in which the default constructor event will be subsequently triggered.
But the default constructor event doesn't support overloading so it will lose its flexibility to instantiate and initialize a particular type of object.
In PB12, parameterized constructor events will be supported, but they will only apply to custom and standard NVO types.
The syntax will be as follows:
objectvariable = create objecttype[(arg1[,arg2]...)]
In .NET, the custom attribute is a class used to represent custom metadata.
In PB12, users will be able to define a custom attribute class, but only some .NET types and their corresponding PB types can be useable as an attribute parameter type.
The syntax will be enhanced to support defining and applying custom attributes as follow:
global type EventPrototype from System.Attribute usage [event]
end type
type variables
public string prototype
end variables
forward prototypes
subroutine EventPrototype(string prototype)
end prototypes
subroutine EventPrototype(string pt)
prototype = pt
end subroutine
[EventPrototype("pbm_lbndblclk")]
event clicked
end event
Published January 5, 2009 Reads 3,133
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Thomas Zang
Thomas Zang is a staff software engineer at Sybase. He works in the Singapore kernel team of the PB department and is in charge of the PowerScript language enhancement project in PB12.0.
- Kindle 2 vs Nook
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- Confessions of a Ulitzer Addict
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Moving Your RIA Apps into the Cloud: Seven Challenges
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Windows 7 – Microsoft’s First Step to the Cloud
- Ulitzer Provides a Powerful Social Journalism Platform
- Jill Tummler Singer, Deputy CIO of CIA, Keynotes at GovIT Expo
- Open Source Mobile Cloud Sync and Push Email
- Kindle 2 vs Nook
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- US Post Office Hops a Ride on NetSuite’s Cloud
- Moving Your RIA Apps into the Cloud: Seven Challenges
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Building a Drag-and-Drop Shopping Cart with AJAX
- What Is AJAX?
- Google Maps! AJAX-Style Web Development Using ASP.NET
- Flashback to January 2006: Exclusive SYS-CON.TV Interviews on "OpenAjax Alliance" Announcement
- AJAXWorld Conference & Expo to Take Place October 2-4, 2006, at the Santa Clara Convention Center, California
- AJAX Sponsor Webcasts Are Now Available at AJAXWorld Website
- How and Why AJAX, Not Java, Became the Favored Technology for Rich Internet Applications
- "Real-World AJAX" One-Day Seminar Arrives in Silicon Valley
- AJAXWorld University Announces AJAX Developer Bootcamp
- AJAX Support In JadeLiquid WebRenderer v3.1
- Where Are RIA Technologies Headed in 2008?
- Struts Validations Framework Using AJAX




































