myst-lang / myst

A structured, dynamic, general-purpose language.
http://myst-lang.org
MIT License
119 stars 17 forks source link

Top level sleep-method #162

Closed Jens0512 closed 6 years ago

Jens0512 commented 6 years ago

Did this a few weeks ago, dunno why i didn't make the pr before now.

Binds to crystal sleep

sleep(1) sleeps for 1 second it also takes floats: sleep(0.01)

sleep() sleeps forever or until the program is interrupted

faultyserver commented 6 years ago

Can the specs for this be moved into Myst? Recently all of the native library specs were ported over, so I'd like to see if we can keep it that way.

For testing, you should be able to use Time.now on either side of sleep, then assert that the difference between them is around the amount of time you expected.

Jens0512 commented 6 years ago

Yes of course

faultyserver commented 6 years ago

LGTM! Thanks :)