chaining abstract operators?

44 views
Skip to first unread message

Justin Donaldson

unread,
Nov 28, 2015, 10:18:31 AM11/28/15
to Haxe
I can easily specify a simple abstract operator like so:

@:op(A * B)
  public function repeat(rhs:Int):MyAbstract {...}

However, it doesn't seem like this works for :

var x : MyAbstract = 4;
x * x * x

Is there a way to specify that an operator should be chained?


Simon Krajewski

unread,
Nov 28, 2015, 12:30:10 PM11/28/15
to haxe...@googlegroups.com
Hi,

this compiles fine for me: http://try.haxe.org/#9df37

Simon

Justin Donaldson

unread,
Nov 28, 2015, 10:12:35 PM11/28/15
to Haxe
Yep, nevermind I had a silly error... I was trying to override an operator on a function type, and didn't put the function body in parens :/



Simon

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
--- You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages