Delegate Types Action, Func and Predicate ?
Posted: Fri Feb 28, 2020 2:18 pm
Hi,
currently mentally searching for alternative ways to implement GetWordCount/GetWordNum better.
One avenue I had tried before was to declare the specific type of delegate, which in C# can be
- Action (fancy name to return void or being command-like)
- Func (Should have realized earlier that this bites with xBase 4-Letter abbreviation of "Function")
- Predicate (fancy name for returning a Boolean)
And check out ways to add or combine them.
which errors on the commented lines. Also "Predicate" not found in xSharp docs.
To be honest: I am not really fond of thinking more along those lines, as it
a) quickliy leads into LINKish structures
b) calling as Delegates has shown measurable performance hit, which I'd rather avoid if possible (could be me not writing best code)
so please just indicate if xSharp supports {Action, Func, Predicate} and if so, what is the syntax for them ?
If they are NOT supported, this is NOT a request to support them ASAP - just knowing that this is not supported as of now is enough, and if I really think I need to try that avenue, I could try via C# directly, to get an idea if IMO xSharp misses something valuable.
More/better Vfp implementation more important near this keyboard
If implementation needs nothing more strenuous than adding 3 new keywords and their mapping to C# keywords implementing them "en passant" might still be useful for those used to C# (or reading up on Dotnet concepts described in C# docs for newbies like me)
regards
thomas
currently mentally searching for alternative ways to implement GetWordCount/GetWordNum better.
One avenue I had tried before was to declare the specific type of delegate, which in C# can be
- Action (fancy name to return void or being command-like)
- Func (Should have realized earlier that this bites with xBase 4-Letter abbreviation of "Function")
- Predicate (fancy name for returning a Boolean)
And check out ways to add or combine them.
Code: Select all
BEGIN NAMESPACE XSharp.VFP
/// action __DoOnChar(tc2Check as Char)
///* predicate __IsInDe(tc2Check as Char)
Delegate __IsInDelimiterArray(tc2Check as Char) as Boolean
Delegate __GetWordCountActive(tcString AS STRING) as Long
Delegate __GetWordNumActive(tcString AS STRING, tnWordNum as Int) as String
To be honest: I am not really fond of thinking more along those lines, as it
a) quickliy leads into LINKish structures
b) calling as Delegates has shown measurable performance hit, which I'd rather avoid if possible (could be me not writing best code)
so please just indicate if xSharp supports {Action, Func, Predicate} and if so, what is the syntax for them ?
If they are NOT supported, this is NOT a request to support them ASAP - just knowing that this is not supported as of now is enough, and if I really think I need to try that avenue, I could try via C# directly, to get an idea if IMO xSharp misses something valuable.
More/better Vfp implementation more important near this keyboard
If implementation needs nothing more strenuous than adding 3 new keywords and their mapping to C# keywords implementing them "en passant" might still be useful for those used to C# (or reading up on Dotnet concepts described in C# docs for newbies like me)
regards
thomas