Introducing two open source development tools from Synergex
Symphony Framework and CodeGen add power to your Synergy development
At the Synergy DevPartner Conference in Chicago last month, we debuted two new development tools created by the Professional Services Group: Symphony Framework and CodeGen.
Both tools help Synergy developers get where they want to go faster. Symphony Framework is a set of classes and capabilities that help developers migrate their traditional Synergy/DE applications to a Windows Presentation Foundation desktop user experience. And CodeGen enables developers to generate source code and other types of content, including XML files, HTML files, and ASP.NET Web Forms.
Both tools are open source projects on the CodePlex web site and are available to you right now to download and use:
You can also “follow” the projects on the CodePlex site to be notified when the projects are updated.
Learn more at the upcoming Synergy DevPartner Conference in York, UK.
Generic methods and delegates
By Jim Sahaj, Senior Software Engineer, Synergy/DE
In a previous version of Synergy .NET, we introduced generic types. In version 9.5.3 we completed generics by adding support for declaring and using generic methods and generic delegates. With generics, you can create a method or delegate that can accept different types of data. You don’t have to specify data types until a method or delegate is constructed, and types can differ for different constructions of the same method or delegate. This useful method for consolidating code is available throughout the .NET Framework.
Generic method syntax closely follows generic type syntax. For example, the following defines a generic method named writeit:
import System.Collections
namespace ns1
public class class1
public static method writeit<T(IEnumerable)>, void
parm1, T
record
var, @*
proc
foreach var in parm1
console.writeline(var)
end
endclass
endnamespace
A generic delegate is defined as follows:
namespace ns1
delegate deleg1<T(IEnumerable)>, void
parm1, T
enddelegate
endnamespace
As with their generic type counterparts, you can place constraints on the type parameters to control what types can be passed in when they are constructed. In addition, you can use the type parameter as the type specified in the constraint, so you have access to its members within the generic method declaration. In the code above, for example, we are able to do a FOREACH on parm1 since it has the constraint IEnumerable.
To construct and use the generic methods and delegates, just provide types that meet the constraints for the type parameters. For example:
main
record
alist, @ArrayList
dvar, @deleg1<ArrayList>
proc
alist = new ArrayList();
alist.Add("hey")
alist.Add("you")
ns1.class1.writeit<ArrayList>(alist)
data arr, [#]int, new int[#] { 1,2,3 }
ns1.class1.writeit<[#]int>(arr)
dvar = ns1.class1.writeit<ArrayList>
dvar(alist)
The code above produces the following output:
hey
you
1
2
3
hey
you
For more information on generics, including generic methods and delegates, see "Generic Types" in the "Understanding Objects and Classes" chapter of the Synergy Language Reference Manual.
Prompted for a reboot when installing Synergy/DE 9.5.3a
Question
When I install Synergy/DE 9.5.3a, I am prompted for a reboot. Why?
Answer
Starting with 9.5.3a, the installation installs updated Visual Studio 2010 C++ runtime files that have the latest Microsoft security patches. If your system does not already have these files, they will be installed and you may be prompted to reboot. If any of these files are in use, you may see a "Files In Use" message. Note that these files may be used by a number of applications—Microsoft Word, Visual Studio, a service running in the background—so simply having a Word document open could cause the message to display. For best results, always stop all running applications when installing any new software.
Synergy/DE pros, see if you can answer this question!
What is the output of the following program?
namespace kitchen
class pantry
public virtual property thyme, i
method get
proc
mreturn m_thyme
end
method set
proc
m_thyme = value
end
endproperty
protected m_thyme, integer
endclass
class fund extends pantry
public override property thyme, i
method get
proc
mreturn 0
end
endproperty
endclass
endnamespace
main
record
spice_rack ,@pantry
proc
open(1,o,"TT:")
spice_rack = new fund()
spice_rack.thyme = 2
spice_rack.thyme = spice_rack.thyme + 5
writes(1,string(spice_rack.thyme))
end
a. 7
b. 5
c. 0
d. A runtime error
e. This does not compile
Click to read answer
|