Haxe Pattern Matching Syntax

110 views
Skip to first unread message

Laurence Taylor

unread,
Dec 8, 2012, 4:55:47 AM12/8/12
to haxe...@googlegroups.com
Is there any description of the pattern matching syntax anywhere? 
abstract types too, as I'm at it.

regards,
Laurence

Simon Krajewski

unread,
Dec 8, 2012, 4:57:01 AM12/8/12
to haxe...@googlegroups.com
Am 08.12.2012 10:55, schrieb Laurence Taylor:
> Is there any description of the pattern matching syntax anywhere?
> abstract types too, as I'm at it.

I will write a full description once the syntax is final, but this gist
should show the gist of it: https://gist.github.com/6dede0058961cb3ba6ab

Simon

Laurence Taylor

unread,
Dec 8, 2012, 5:03:00 AM12/8/12
to haxe...@googlegroups.com
brilliant, thanks


Laurence Taylor

unread,
Dec 8, 2012, 5:20:52 AM12/8/12
to haxe...@googlegroups.com

Is it limited to macros? I've tried lensing through enums, and the 'in' syntax

case Enum1(Enum2(s) : trace(s);//"Unknown Identifier"
case Enum1(s) in (s == 'wotcha') : s; //This expression is not allowed outside a for loop

regards,
Laurence

Simon Krajewski

unread,
Dec 8, 2012, 5:21:49 AM12/8/12
to haxe...@googlegroups.com
Am 08.12.2012 11:20, schrieb Laurence Taylor:

Is it limited to macros? I've tried lensing through enums, and the 'in' syntax

case Enum1(Enum2(s) : trace(s);//"Unknown Identifier"
case Enum1(s) in (s == 'wotcha') : s; //This expression is not allowed outside a for loop

Do you have -D pattern_matching in place?

Simon

Laurence Taylor

unread,
Dec 8, 2012, 5:22:47 AM12/8/12
to haxe...@googlegroups.com
thought there might be a compiler switch,
thanks

On Sat, Dec 8, 2012 at 11:21 AM, Simon Krajewski <si...@haxe.org> wrote:
have -D pattern_matching

Reply all
Reply to author
Forward
0 new messages