Hostname: Difference between revisions

m
m (→‎{{header|Wren}}: Minor tidy)
 
Line 1,050:
However, if Wren is embedded in (say) a suitable Go program, then we can ask the latter to get it for us.
 
<syntaxhighlight lang="ecmascriptwren">/* hostnameHostname.wren */
class Host {
foreign static name() // the code for this is provided by Go
Line 1,059:
which we embed in the following Go program and run it.
{{libheader|WrenGo}}
<syntaxhighlight lang="go">/* hostnameHostname.go */
package main
 
Line 1,076:
func main() {
vm := wren.NewVM()
fileName := "hostnameHostname.wren"
methodMap := wren.MethodMap{"static name()": hostname}
classMap := wren.ClassMap{"Host": wren.NewClass(nil, nil, methodMap)}
9,486

edits