Skip to content

Releases: liquidev/euwren

0.13.3 – Concrete generic type support

17 Jan 22:09
Compare
Choose a tag to compare

This release introduces sloppy support for concrete generic types. This is still a heavy WIP, but the initial implementation is here. This does not break any existing code.

Concrete generic types are generic types that are already instantiated. For instance, binding glm.Vec2[float] works, but glm.Vec fails, because the latter is not a concrete type.

0.13.2 – Minor fixes and changes

22 Dec 20:54
Compare
Choose a tag to compare

As the title suggests, this release brings some minor fixes and changes.

  • Injecting Wren now works in classes again:
    wren.foreign("example"):
      [Inject]:
        """
        sayHello() { System.print("Hello!") }
        """
  • There's a new {.noFields.} pragma that can be added to object class bodies, disabling the generation of fields.
  • call(vm: Wren, theMethod, receiver: WrenRef, args: varargs[WrenValue]) is now call(theMethod, receiver: WrenRef, args: varargs[WrenValue, toWrenValue]).

0.13.1 – Hotfix for stropped proc names

22 Dec 11:46
Compare
Choose a tag to compare

This release fixes a bug where stropped procs (eg. `[]`) would throw an invalid binding error.

0.13.0 – Inline procedures

21 Dec 19:09
Compare
Choose a tag to compare

This release brings support for inline procedures.

Inline procedures are a way of binding procedures directly, without having to declare it before it's bound.

wren.foreign("example"):
  [Inline]:
    normalProc do ():
      echo "hi!"
    ?getter do -> int: 32

0.12.2 – Fix for non-literal default parameters

21 Dec 17:37
Compare
Choose a tag to compare

This release fixes a problem where non-literal parameters would crash:

var x = 2
proc example(a = x) = discard
wren.foreign("example"):
  [Default]:
    example

Now the above example compiles properly, without errors.
The release introduces a workaround for Nim/#12942, which prevented euwren from properly generating slot getters from the Wren VM (and doing a bunch of other stuff required to make euwren work).

0.12.1 – "Wildcard" parameters in explicit overloads

20 Dec 13:36
Compare
Choose a tag to compare

This release introduces support for _ as a parameter for overload resolution. This fixes an issue where certain procs were unbindable, due to default parameter values:

type
  Thing = object
var thing = Thing()
proc test(a = thing) = discard

wren.foreign("test"):
  Thing:
    # if we were to leave the parameters out, it would be a compile error because for some reason
    # default parameters are untyped, and I can't get the type of ``Ident "thing"``.
    # the solution is to use the "wildcard":
    *test(_)

These parameters are not proper wildcard parameters. This may be introduced in some future release, but for the time being, this simply marks the parameter as ignored when resolving overloads. If euwren finds more than one overload, an error will still be thrown.

I understand this doesn't entirely solve the problem, but most cases are covered nevertheless. You almost never create an add overload with the parameters (s = myEmptyString, i = myNumber), or something similar.

0.12.0 – Tuple support

18 Dec 19:43
Compare
Choose a tag to compare

This release adds support for tuples. Example:

type
  Rect = tuple[x, y, width, height: float]
wren.foreign("rect"):
  Rect: discard # the constructor is generated implicitly
import "rect" for Rect
var r = Rect.new(10, 10, 20, 20)
System.print(r.width * r.height)

0.11.0 – New syntax, code cleanup

18 Dec 18:39
Compare
Choose a tag to compare

This release brings new syntax to foreign(), and also a major cleanup removing lots of bloat from the source code. The syntax change also means that old programs using euwren will break after this release.

  • Constructors are now gone. Use aliased static procs instead.
    This change was motivated by the fact that they could not be aliased, the allocation had to be implemented for them separately (which violated DRY), they were poorly coded, so hacks like {.dataClass.} had to be made, and there could be only one per class. Static procs fulfill all the needs right now, and the performance impact is negligible.
  • Namespace and class bindings have been separated. Namespaces are declared using brackets, and cannot use -> for aliasing:
    wren.foreign("example"):
      [MyNamespace]:
        thing
    Objects don't use brackets, and can be aliased using -> like in pre-0.11:
    wren.foreign("example"):
      MyObject:
        doThing
  • The syntax for binding procs has been changed. Annotations ([someAnnotation]) have been removed, and replaced with prefix operators.
    wren.foreign("example"):
      MyObject:
        # static procs should be prefixed with *
        *staticProc
        # regular procs are bound as usual
        normalProc
        # getters should be prefixed with ?
        ?getter
    Any other syntax (including pragmas) is now invalid.
    In namespaces, all procs are implicitly static. This behavior cannot be changed. If you try to use * on a proc in a namespacing, euwren will warn you that it's ignored.

Everything else is exactly how it was, including specifying overloads, aliasing, and enums.

0.10.1 – Hotfix for module procs

16 Dec 21:52
Compare
Choose a tag to compare

This release fixes the behavior of onLoadModule and onResolveModule to better work with what vanilla Wren offers:

  • When the onLoadModule callback is called and returns an empty string, an error will not be thrown. This fixes support for importing empty files.
  • When the onResolveModule callback is called and returns an empty string, an error will now be thrown. This was an overlooked bug.

0.10.0 – Array and seq support; imports

16 Dec 21:47
Compare
Choose a tag to compare

This release brings array and seq support, closing #9.

  • Proc parameters and return types can now be array or seq, they can be nested as deeply as you'd ever want.
  • Added onLoadModule(vm: Wren, callback: proc (name: string): string). This proc sets a callback that should return the source code of module name when called. If the returned source code is an empty string, an error is thrown at the user.
  • Added onResolveModule(vm: Wren, callback: proc (importer, name: string): string). This proc sets a callback that can transform a given module's name before it's actually imported. This is usually used for relative imports.
  • [](vm: Wren, module, name: string, T: typedesc) is now [](vm: Wren, module, name: string, T: typedesc = WrenRef), and the dedicated no typedesc param version has been removed. This does not break any regular code.
  • [] now checks if the variable's type matches T, throwing an exception nagging the user if the type does not match.