Skip to content

Become Useful If Not Elegant

Pre-release
Pre-release
Compare
Choose a tag to compare
@jcburley jcburley released this 24 Mar 19:28
· 658 commits to gostd since this release

This release wraps most (90% or more) functions, provides constructors for most defined types, and supports many useful operations.

For example, this version of Joker can send emails via SMTP.

Much still needs to be done; see the docs for a partial list. Meanwhile, here are some highlights (from GOSTD.md) of what's new:

... arguments are now supported for functions, methods, and receivers, unless the underlying type is any other type Joker decides to pass by reference (currently these are all non-empty struct{} types; as a result, reflect.Append() is unsupported). E.g.:

user=> (go.std.fmt/Println (go.std.net/IPv4 1 2 3 4) (go.std.net/IPv4Mask 255 255 255 127))
1.2.3.4 ffffff7f
[17 nil]
user=>

^GoObject arguments are extended to support many native Joker types via their underlying (Native) types. E.g.:

user=> (go.std.fmt/Println 1 2 3 4)
1 2 3 4
[8 nil]
user=>

[]byte arguments and fields are now supported in function calls and ctors, and also support automatic conversion from strings (e.g. an object of type String). There are more conversions like this to come, but this is a nice proof-of-concept, as it enables (for example) sending an email to an SMTP server.

A Vector or Seq may be provided in lieu of a String (this might be too general!). E.g.:

user=> (go.std.fmt/Printf [65 66 67 10])
ABC
[4 nil]
user=>

Got chan and (empty) struct{} types working at a rudimentary level.

Receivers that have no return values are now implemented; their Joker wrappers return NIL, just as for regular functions and methods.

Types defined (recursively) in terms of builtin types are now pass-by-value (and construct-by-value), as is struct{}.

Note that constructors for pass-by-reference types return reference types. E.g. (new Foo ...) returns refToFoo. Assuming the Go code defines methods on *Foo, they should work on the result; else, one should be able to dereference and then invoke them, as in (Go (deref my-foo) :SomeMethod ...).

Though some namespaces redefine (shadow) built-in types such as String and Error, (catch <type> ...) now first checks type to see whether it is a symbol that names one of the built-in types (and does not specify a namespace). If so, that type is used, rather than an error resulting.