xsharp.eu • typed codeblocks in predicates
Page 1 of 1

typed codeblocks in predicates

Posted: Mon Sep 30, 2019 8:43 am
by wriedmann
Hi,

using the X# runtime and VO dialect, I have thiscode:

Code: Select all

using System.Collections.Generic

class SyntaxCmpletion
protect _oList as List<Exception>

constructor()
   _oList := List<Exception>{}
   return

method CheckSyntax( cMessage as string ) as Exception
   local oResult			as Exception

   oResult := _oList:Find( {| o as Exception | o:Message == cMessage } )

  return oResult
end class
Should that compile?
Using the C# syntax it compiles:

Code: Select all

oResult := _oList:Find( { o as Exception => o:Message == cMessage } )
With the codeblock syntax the compiler gives the following message:

Code: Select all

error XS9057: Typed parameters in codeblocks are not supported by the (Vulcan) runtime.
even if I use the X# runtime.

Wolfgang

typed codeblocks in predicates

Posted: Mon Sep 30, 2019 10:25 am
by robert
Wolfgang
For now you have to use the Lambda expression syntax in these cases.
Typed codeblocks are on our todo list.

Robert

typed codeblocks in predicates

Posted: Mon Sep 30, 2019 11:43 am
by wriedmann
Hi Robert,

that is ok - wasn't sure if it was an error or a todo. Therefore I preferred to aks before adding a ticket (and this was an issue I've encountered several times before in other occasions).
The important thing for me is that I have a way to go forward (and I have that).

Wolfgang
P.S. I'm currently working on a production capacity planning system in 100% X# and WPF, but most of the data comes from a DBF based VO application