Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can GO be used as a scripting engine within an application?

Can GO be used as a scripting language within an application ? I can't find any informations about this: is there a dynamic link library version which could be interfaced from a Windows application with some standard methods such as Compile(), Execute and features such as callbacks, variables sharing etc ?

like image 629
az01 Avatar asked Jun 01 '12 13:06

az01


People also ask

Can you use Go for scripting?

However, whereas shells are optimised for the specific tasks of scripting and job control, Go is a general-purpose language, used for all sorts of different applications. That doesn't mean that we can't use it for systems programming, though.

Is Go a scripting language or programming language?

Go (also called Golang or Go language) is an open source programming language used for general purpose. Go was developed by Google engineers to create dependable and efficient software. Most similarly modeled after C, Go is statically typed and explicit.

What is scripting in application?

Application scripting allows users to control an application's behavior by writing scripts. For example, users might write scripts to automate routine tasks. They might use scripts to add new features or to customize existing functionalities.

What is the engine of a script?

A scripting engine is commonly defined as a vehicle for implementing scripts in scripting languages.


2 Answers

This might sound strange at first but go with me on this: I think it would be a perfect candidate for a scripting language because it's compile time is so fast....hear me out...

Most scripting languages are interpreted, and so they do not require (or even provide in some cases) compilation. However compiled languages are safer in general because they can catch certain errors at compile time, which is better than, for example, catching a syntax error at runtime.

With Go, the compile time is so speedy that whatever program is running your Go code (e.g. a web server) could hypothetically compile the code on-demand if the code has changed, and otherwise use the compiled version.

Actually if you check out Google App Engine and download their dev web server for Go (https://developers.google.com/appengine/) you'll notice that their web server does exactly this. If you run through their Hello World tutorial for Go you'll notice that if you make changes to your code you won't need to recompile the Go code in order for the changes to take affect.

like image 117
Adam Avatar answered Nov 16 '22 02:11

Adam


Go is not a scripting language. Because Go is designed for fast compilation, there have been some attempts to use it as a scripting language. For example,

  • gorun
  • GoNow
like image 38
peterSO Avatar answered Nov 16 '22 01:11

peterSO