[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] tamale-1.2 - Erlang-style pattern matching library
- From: David Manura <dm.lua@...>
- Date: Fri, 24 Sep 2010 23:11:28 -0400
On Fri, Sep 24, 2010 at 9:50 AM, Scott Vokes <vokes.s@gmail.com> wrote:
> I'm not set on testing strings with :match rather than just ==,
> either. Perhaps it could be activated by an optional optional
> match=true flag on the pattern row, like { "foo %d+", handle_num,
> match=true } ?
That does prevent having a pattern {a, b} where where a should be
matched as a literal string and b should be matched as a string
pattern.
> Would it suffice to add a row flag, "partial=true", to allow the
> table value being matched to have more elements than the pattern?
It might, but again, these row flags tend to limit
expressiveness--e.g. having a pattern {a, b} where a is matched fully
and b is matched partially, or having a pattern that fully matches the
array part of a table but ignores other fields in the table.
> I'm planning on adding a special case for a variable V"...", which
> captures the remaining of the array-portion values: with { V"a", V"b",
> V"..." }, {1, 2, 3, 4, 5} would match to {a=1, b=2, ["..."]={3, 4, 5}}.
Yes, although a similar thing may be needed for the hash-portion.