cloe-lang / cloe

Cloe programming language
https://cloe-lang.org
MIT License
410 stars 10 forks source link

import golang packages eco-system #98

Open avelino opened 6 years ago

avelino commented 6 years ago

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

raviqqe commented 6 years ago

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.

avelino commented 6 years ago

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