cloe icon indicating copy to clipboard operation
cloe copied to clipboard

import golang packages eco-system

Open avelino opened this issue 6 years ago • 2 comments

Retro compatibility with native Golang packages

(goimport "fmt")

(fmt.Println "Hello, world!")

We can create a keyword for this import, example goimport We were able to use all Golang's eco-system inside the rumlang, we would have many batteries included.

Look how it was implemented: https://github.com/goby-lang/goby/blob/83e063d807b73d7d41b6cf3875ed037def104886/vm/plugin_integration_test.go goby presentation-15

more info: https://goby-lang.gitbooks.io/goby/content/plugin-system.html

avelino avatar Jun 10 '18 16:06 avelino

The challenge here is how to associate Cloe's data types with Go's because the former is similar to JSON and quite different from the latter. Moreover, Cloe doesn't support method calls as it's dedicated to functional programming rather than object-oriented one. However, I'm definitely sure that something simple like the fmt.Println works in Cloe as well as Goby. Thank you for your suggestion! I will investigate it soon.

raviqqe avatar Jun 11 '18 06:06 raviqqe

fmt.Println It was an example. The idea is to enjoy external packages of the Go eco-system, example:

(goimport "github.com/avelino/slugify")

(slugify.Slugify "Hello, world!")

STDOUT: hello-world

avelino avatar Jun 11 '18 09:06 avelino