Wait?

This forum is meant for questions and discussions about the X# language and tools
Post Reply
FFF
Posts: 1532
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Wait?

Post 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?
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
Chris
Posts: 4587
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Wait?

Post 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()
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Post Reply