Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type definer command thingy #19

Open
mcmonkey4eva opened this issue Sep 4, 2016 · 0 comments
Open

Type definer command thingy #19

mcmonkey4eva opened this issue Sep 4, 2016 · 0 comments

Comments

@mcmonkey4eva
Copy link
Member

Requires #10
Syntax: definetype <Type> <Variables Map> <Tags Map>
Example:

function flowdefine MyVector^length_squared
{
    var xsq = <{[this].x.multiply[<{[this].x}>]}>;
    var ysq = <{[this].y.multiply[<{[this].y}>]}>;
    var zsq = <{[this].z.multiply[<{[this].z}>]}>;
    var result = <{[xsq].add[<{var[ysq]}>].add[<{var[zsq]}>]}>;
}
definetype MyVector x:0|y:0|z:0 length_squared:MyVector^length_squared;
var vec = <{myvector[x:1|y:2|z:3]}>;
echo <{[vec].x}>;
echo <{[vec].length_squared}>

Possibly setter thingies as well? And constructors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant