Skip to content

Instantly share code, notes, and snippets.

@mamcx
Created September 17, 2013 14:01
Show Gist options
  • Save mamcx/6594708 to your computer and use it in GitHub Desktop.
Save mamcx/6594708 to your computer and use it in GitHub Desktop.
Ideas for my own language
timerChan = chanel(out=chanx:Date)
await def:
time.Sleep(10)
timerChan |> time.Now() # send time on timerChan
#Do something else; when ready, receive.
#Receive will block until timerChan delivers.
#Value sent is other goroutine's completion time.
completedAt <| timerChan
for True:
if v <? ch1:
print("channel 1 sends", v)
elif v <? ch2:
print("channel 1 sends", v)
else:
print("neither channel was ready")
def save:Bool | Err
if not(self.valid):
@error('Invalid')
return True
saved | err = save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment