Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Last active June 13, 2019 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseoliv/e14272fb6ec0a5a5d2bc5d23fa75b73f to your computer and use it in GitHub Desktop.
Save joseoliv/e14272fb6ec0a5a5d2bc5d23fa75b73f to your computer and use it in GitHub Desktop.
extract
package metaobjectTest
@doc{*
Annotation 'extract' is replaced by an Int value corresponding to
its argument, which should be of the form 'int_value' or 'intvalue'.
Example:
assert extract(int5) == 5;
assert extract(int_555) == 555;
This annotation is used inside a generic prototype to simulate
the passage of an Int as argument:
var v = MyVector(Int, int_100) new;
MyVector could have been declared as
object MyVector<T, V>
var Array<T> array = Array<T> new: @extract(V);
...
end
*}
object Extract
func run {
var v = generic.MyVector<Int, int_100> new;
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment