[erlang-patches] [jinterface] add erlang term parse/match/bind features
Dmitriy Kargapolov
dmitriy.kargapolov@REDACTED
Wed Dec 31 17:31:09 CET 2014
Hi Vlad,
Thank you much for your notes.
I agree some names were not good enough, I changed these per your
suggestion.
Old comment removed as well.
As to OtpErangMap class - I was not going to re-implement it initially.
But in order to add match/bind I had to do this. I tried to not add much
new methods, keeping implementation rather "just enough" to work with
maps. You are very welcome to add/change whatever you see reasonable in
separate PR though.
Best Regards and Happy New Year!
- Dmitriy.
git fetch https://github.com/x0id/otp.git jinterface_pattern_matching
https://github.com/x0id/otp/compare/erlang:master...jinterface_pattern_matching
https://github.com/x0id/otp/compare/erlang:master...jinterface_pattern_matching.patch
On 12/31/2014 10:27 AM, Vlad Dumitrescu wrote:
> Hi Dmitriy,
>
> Nice implementation! I have something similar that I wanted to submit,
> but I like some of your details better.
>
> I have a few comments, after browsing the code just briefly:
>
> - I would prefer to have the OEMap changes as a separate PR, as it's a
> separate issue and there are more things to address there, like for
> example, OEMap could also implement Map, like OEList implements
> Iterable (and might implement List).
> - I don't like the name OEVarrier, it doesn't mean anything. Maybe
> OEMatcher would be better?
> - OEBind might be clearer as OEBinding, as it contains a set of bindings?
> - I think there are still some merge issues, like for example
> OEList:299 where the comment is from the old equals method
>
> best regards,
> Vlad
>
>
> On Tue, Dec 30, 2014 at 9:56 PM, Dmitriy Kargapolov
> <dmitriy.kargapolov@REDACTED <mailto:dmitriy.kargapolov@REDACTED>>
> wrote:
>
> This implements functionality similar to following C functions,
> which are part of erl_interface application:
> - ETERM *erl_format(FormatStr, ...);
> - int erl_match(ETERM *Pattern, ETERM *Term);
>
> To acheve this new classes introduced:
> * OtpErlangVar - variable placeholder;
> * OtpErlangBind - variable values collection;
> * OtpErlangParser - "erl_format" parser implementation;
> * OtpErlangPattern - pattern abstraction with match/bind functions;
>
> Classes representing composite objects OtpErlangList,
> OtpErlangTuple, OtpErlangMap and new OtpErlangVar implement
> interface OtpErlangVarrier defining match and bind functions for
> these objects.
>
> Class OtpErlangMap reworked to be based on HashMap instead of two
> separate lists keeping keys and values. This is close to native
> semantics of maps and makes easier implementing basic map
> manipulations.
>
> It addition to OtpErlangBind custom user's class may be used as
> receiver of matched variables values. Java reflection is used to
> prepare variable value setters during the parse stage. Java doc
> has more details and examples. Test cases implemented.
>
> git fetch https://github.com/x0id/otp.git jinterface_pattern_matching
>
> Thanks.
>
>
>
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED <mailto:erlang-patches@REDACTED>
> http://erlang.org/mailman/listinfo/erlang-patches
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20141231/f0464daa/attachment.htm>
More information about the erlang-patches
mailing list