typed codeblocks in predicates

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

typed codeblocks in predicates

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

typed codeblocks in predicates

Post by robert »

Wolfgang
For now you have to use the Lambda expression syntax in these cases.
Typed codeblocks are on our todo list.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

typed codeblocks in predicates

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply