[erlang-questions] If you are homesick for object.selector
Darach Ennis
darach@REDACTED
Sat Jan 26 01:13:27 CET 2013
Hi guys,
I have no beef with these parse transforms you speak of. But, I haven't
used them so will stop at wishing them good health - maybe pencil in a few
hours
with them as penance for my non-erlangy sins too. :)
I think folk new to erlang will likely be familiar with XML Path though. So
picking up a variant based on XPath 1.0 would be fairly natural. I'm
clutching
at straws here, but maybe parse transforms have a role to play here too.
I see no reason why Joe's selector couldn't be bound as function in some
kind of erlangy xpath for tuples. So we would get something like:
P = tpath:scan(X, "/top/a/x/p").
No hints required. The path is explicit. The hints in the parse transform
would equate to the following XPath
P = tpath:scan(X, "/top//p").
If the structure changed so there was a list of x's and we just want the p
from the first occurrence?
P = tpath:scan(X, "/top/x[first()]/p").
Maybe I want all p's matched on some guard or filter?
P = tpath:scan(X, "/top/x[key =/= 'corba']/p[@a]").
And, maybe parse transforms, funs could be plugged in too ...
P = tpath:scan(X, "some_module:some_fun(//p[@a)").
Perhaps I'm stuck with the xpath style bag because it's familiar
and I've been using it for ~14 years. The cool young kids might
prefer a more jsony selection experience. I could live with that:
P = jsony:scan(X, "top.a.x.p");
But this: #top{a=#one{x=#foo{p=P}}} = X
I can barely parse it visually. It's too noisy, too busy.
Cheers,
Darach.
On Fri, Jan 25, 2013 at 10:37 PM, Raoul Duke <raould@REDACTED> wrote:
> please contribute to getting LFE back in motion.
> $0.02,
> sincerely.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130126/378e551e/attachment.htm>
More information about the erlang-questions
mailing list