4 ms·
As far as I know, that's "regular gisp (rm $(command -v gisp); go get -u github.com/jcla1/gisp), and the full hello.go it produces is: cat hello.gsp (ns ma
by e12e 11y ago
As far as I know, that's "regular gisp (rm $(command -v gisp); go get -u github.com/jcla1/gisp), and the full hello.go it produces is:
cat hello.gsp
(ns main
"/fmt"
"/net/http")
(def hello (fn [w r]
(fmt/fprintf w "hello")
()))
(def main (fn []
(http/handle-func "/" hello)
(http/listen-and-serve ":8080" nil)))
gisp hello.gsp
package main
import (
"/fmt"
"/net/http"
)
func hello(w, r core.Any) core.Any {
fmt.Fprintf(w, "hello")
return nil
}
func main() {
http.HandleFunc("/", hello)
http.ListenAndServe(":8080", nil)
}
(Which go won't compile due to errors with imports, missing core.Any
etc).
I realize hn isn't the best place to discuss issues, but if anyone have
played with gisp, and could shed some light (eg: maybe gisp is go 1.4
only?) that'd be great.
Incidentlially gsp/gspc seems to work as intended. Maybe I'm
misunderstanding the purpose of gisp?
- eatonphil 11y agoI think you are just having path issues. Also, you are using a gsp example to test gisp. There are a few shorthands that gsp supports that gisp does not - such as imports starting with /. Gisp will not resolve these. If you continue to have issues and want to get it working correctly, feel free to email me.
- e12e 11y agoThank you four your reply. I had my suspicions that might be the issue (the shorthand/differences between gsp/gisp in particular). I also played a bit with the simple factorial example[f] from gisp -- which apparently doesn't work with gps(c) (gisp apparently allows calling casts as functions [eg: (int ImNotAnIntButAfloat)] -- looks like gsp chokes on that. After some tweaking I couldn't get [f] to work with gsp (but it worked fine with gisp + go build). Looks like both projects could use some more (esp. motivating) examples, and maybe a little more introduction/documentation. At least enough to encourage play :-) [f] https://github.com/jcla1/gisp/blob/master/examples/factorial.gsp https://github.com/jcla1/gisp/blob/master/examples/factorial...
- eatonphil 11y agoGood call with the casting issue. I'd been seeing that that wasn't working correctly but I just now figured it out. Gisp lacked the ability to have function arguments actually be functions themselves. Gsp gets around this by casting __all__ (a lazy move, I know) functions to interface{} then to func([arg core.Any]+) core.Any. I do stop this behavior for a certain whitelist - I need to add int/float64/bool/string to that list I think. This was definitely just a first step. I think getting the Prelude to work is by far the coolest part. It did actually take a lot of trial and error hacking gisp -> gsp to get it working. After this I will probably look into self-hosting documentation and maybe a cookbook.
- e12e 11y agoGood to hear :-) Btw, I'm still not sure what "prelude" means in this context...