The Synergy .NET compiler has been updated to correct an issue where a symbol defined outside a routine could unintentionally cause an .ifdef condition to evaluate as defined when multiple source files were compiled as a single compilation unit. For example, a field defined in a global structure, rather than for the routine, could cause an .ifdef <fieldname> condition to be considered defined. With this change, the compiler now uses only local routine symbols by default when resolving .ifdef conditions. To restore the previous behavior, a new "Allow global symbols in ifdef directives" option has been added to the Compile page of project properties. When selected, this option sets a new internal Synergy .NET compiler option (-qrelaxed=ifdef).
We added support in Synergy .NET for the OverloadResolutionPriority attribute, which allows you to influence method overload resolution. When multiple overloaded methods are applicable to a method call, the overload with the highest priority value is selected. (The default priority is 0, and higher values indicate higher priority.) This attribute can be helpful when introducing a newer overload (e.g., a more performant implementation) and you want future builds to prefer it without requiring changes to existing calls. For example, in the code below, both overloads of PrintValue are applicable for the call Example.PrintValue(5). Because the short overload has a higher priority, it is selected:
public class Example
public static method PrintValue, void value, int
proc Console.WriteLine("int overload") endmethod
{OverloadResolutionPriority(1)}
public static method PrintValue, void value, short proc Console.WriteLine("short overload") endmethod
endclassmain
proc Example.PrintValue(5) end
Synergy .NET now supports params parameters on selected collection types--e.g., Span<T> (cf. https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-13#params-collections)--in addition to arrays. This works like params T[], but instead of collecting arguments into an array, the compiler collects them directly into the specified collection type.
public class Totals public static method Total, int
params values, Span<int> proc data sum, int, 0 foreach data v in values sum += v endforeach mreturn sum endmethod endclass
mainproc Console.WriteLine(Totals.Total(1, 2, 3)) ;6
end
myarray ,13[d1] dvar ,d2 . . . myvar = myarray(dvar)
begin data ok, boolean, true if (!ok) Console.WriteLine("Fail") end
Professional Services Looking for help to advance your Synergy applications?