Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Feature: Support for specifying host method arguments by name [80]

$
0
0
Neither JavaScript nor VBScript have native support for named arguments, but some way to specify host method arguments by name might be useful.
Comments: As we evaluate this feature, we'd love to hear your ideas about what named arguments would look like in JavaScript and VBScript. Here's one JavaScript possibility: ``` JavaScript engine.AddHostObject("host", new HostFunctions()); engine.AddHostType(typeof(Console)); engine.Execute(@" Console.WriteLine(host.args({ format: 'Pi = {0}', arg0: Math.PI })); "); ``` In this case the script code would invoke [this method](https://msdn.microsoft.com/en-us/library/586y06yf(v=vs.110).aspx). Thoughts?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images