4 ms·
Introducing agora: a dynamic, embeddable programming language built with Go
- x3ro 13y agoThis language seems to remove lots (almost all?) of the goodies of Go, like multiple return values, type checking by the compiler, gofuncs and channels, slices, maps and enforced naming conventions, and replace them with stuff from PHP, like interpreting "0" and "nil" as false and weird meta-methods.
- PuerkitoBio 13y agoHi, author here. Actually, Lua and Javascript were more of an influence than PHP (I don't know PHP much). But type checking was an obvious thing to remove since I'm aiming for a dynamically-typed language, and I do want sufficiently different (and looser) constructs than Go so that it can find its niche, otherwise what's the point? I'm definitely not done, and multiple return values are one of the points I'm not fully decided yet (this is a v0.1 after all). Interaction with channels are on the roadmap, and concurrency can be done in the Go host to run different execution contexts.
- JulianMorrison 13y agoYeah, the senseless differences are deal breakers for me. It seems to be written by someone who is pining for Java - single returns and exceptions, no preamble before if, ternary operator, etc. It would have been simpler to just make "dynamically typed Go".
- stcredzero 13y agoWhat I would want in such a language is (in formal set-theoretic terms) a strict superset of Go. I would want something would run code that would also be compiled by the Go compiler, but which would also run programs that omitted type declarations. (Hence, the set of strings that are valid programs is larger than for Go, and also includes all valid Go programs.) Such a language could be used as a REPL and dynamic debugging environment for Go. That would be utterly fantastic.
- vertex-four 13y agoMost of the differences are actually Lua-like semantics, which is perfectly in line with the author's goal of making a "Lua for Go". I suspect that v0.2 will branch out from there a little. Personally, though, if I wanted a Lua for Go, I'd just use Lua (or maybe LuaJIT).
- PuerkitoBio 13y agoThat's fine, I know it can't please everyone, but as mentioned in the docs and the article, this is more about Lua-like semantics with a syntax very close to Go than Java. There are no exceptions per se, there are runtime errors returned to the Go host, and a protected mode using `recover()`. The preamble before `if` is mainly because the variables are function-scoped anyway, but again, a lot of things may change, this is the very first step in a long iteration process, and the feedback I'm getting today from the various forums will help a lot in knowing how to steer the ship.
- ansible 13y agoI was discussing with a friend online about a scripting language for Go that would integrate as well with it as Lua does with C. We concluded, however, that the best option would be to write a Go interpreter (in Go of course). One of the key reasons why is to maintain full compatibility with Goroutines and channels. I never got started on that project though... too many others need finishing. Bravo on publishing your vision!
- PuerkitoBio 13y agoThanks, it's a very early "vision", but I'm happy with the way things are going!
- ansible 13y agoBTW, thanks also for creating 'gocrawl'. We've been trying it out a little bit, it is working good so far!
- PuerkitoBio 13y agoawesome, thanks!
- mseepgood 13y agoOther similar projects: Otto (JavaScript interpreter): https://github.com/robertkrimen/otto https://github.com/robertkrimen/otto Twik (Scheme like): http://blog.labix.org/2013/07/16/twik-a-tiny-language-for-go http://blog.labix.org/2013/07/16/twik-a-tiny-language-for-go
- NateDad 13y agoArg, no... please no float as the default(only) numeric type. That's one of the worst things about javascript.
- tlb 13y agoWhy do you think that? I find JS's numeric rules (float, except when you use bitwise operators) quite convenient and safe. Some examples of things that are awkward with float-only numeric would be helpful.
- millstone 13y agoGo's floating point support is sort of FUBAR. For example, these three equivalent snippets all produce different results: 1. fmt.Printf("%f", 1.0 / -0.0); 2. x := -0.0; fmt.Printf("%f", 1.0 / x); 3. x := 0.0; fmt.Printf("%f", 1.0 / -x);