Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- everyone can use debug
- public scope debug
- -- function in the debug scope...
- in debug function SetPrintExtraInfo(flag:bool)
- -- to use it, we must explicitly use the debug scope:
- function Foo()
- SetPrintExtraInfo(true) -- fails
- debug::SetPrintExtraInfo(true) -- ok
- end
- function Bar()
- use debug
- SetPrintExtraInfo(true) -- ok
- end
- use debug
- function Bar()
- SetPrintExtraInfo(true) -- ok
- end
- in debug function Bar()
- SetPrintExtraInfo(true) -- ok
- end
- -- kinda namespacy
- -- only this module can provide details, but everyone can use it
- in this_module(put), public(use) scope details
- -- private "submodule" with only one exported function
- scope with
- global var state:i64
- in public function Random()
- ....
- end
- end
- in public type HttpResponse with
- -- only this module can construct,
- -- everyone can still destruct (inherited)
- in this_module(construct) case Response(code:i32) with
- -- inherited
- case Success with
- case OK
- case Created
- case Accepted
- end
- case Redirection(url:string) with
- case Permanent
- case Temporary
- end
- case ClientError
- case BadRequest
- case NotFound
- case Forbidden
- end
- case ServerError
- case Internal
- case BadGateway
- end
- -- everyone can get or set, inherited
- field headers:List[{string,string}]
- -- everyone can get, only this module can set
- in this_module(set) field body:string
- end
- in this_module(construct) case NetworkError(os_code:string)
- in this_module(construct) case Timeout
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement