xsharp.eu • Wait?
Page 1 of 1

Wait?

Posted: Fri Nov 30, 2018 11:25 pm
by FFF
Using a X#/Core app (build from the "Basic" sample, no references, no vo switches set) i was looking for an equivalent for Vo's "Wait" for Console.
Typing "Wait" and F9, i got error XS0103: The name '_Wait' does not exist in the current context.
Switching to "Wait()" it changed to error XS9002: Parser: unexpected input '_Wait( ()'
Obviously, there's some trickery at work ;) ?

Now, to hinder my console to dissappear, i used System.Console.ReadLine(), but this is inconvenient: hitting any key, it writes to the screen, hitting Enter i get "type any key...", so to close the console i have first to target the Enter and then need another hit...

There used to be something (a switch?) for an implicit wait, but i can't find this anymore?

Wait?

Posted: Fri Nov 30, 2018 11:50 pm
by Chris
Hi Karl,

You can use System.Console.ReadKey() instead :)

Regarding WAIT, this gets translated to a call to _Wait() by a preprocessor directive found in XSharpDefs.xh (in XSharpInclude)

#xcommand WAIT [<msg>] => _Wait( <msg> )

So you just need to include references to the (any) runtime, where this function is implemented.

Or, if you want, you can implement the function yourself in your code. Or you can modify the directive, to generate something else that you prefer instead, for example

#xcommand WAIT [<msg>] => System.Console.ReadKey()