[erlang-questions] [ANN] Helperl 0.2.0 (Alpha)

Alex Arnon <>
Fri Apr 19 21:53:02 CEST 2013


Hi Vlad!

Thanks for the reply, glad you like the API :)

>From a quick look at your utils package, there are certainly some things I
see Helperl is missing:
- The Bindings interface as the result type of CompositePattern.match(...)
- an easy addition.
- The format(...) function's approach looks very useful. Particularly if it
would be possible to compile it to a generator.
- I like the the pattern matching format, and would like to be able to
compile it to a CompositePattern - which can then be mixed with guards,
kept statically etc. This would be more natural than Helperl's current
verbose mapping.

Do you have any wrapper for OtpMbox's, e.g. Helperl's ESimpleService, or
any gen_server-alike?

Cheers,
Alex.


On Fri, Apr 19, 2013 at 11:28 AM, Vlad Dumitrescu <>wrote:

> Hi Alex!
>
> Nice work! I like the API.
>
> We have some similar extensions to jinterfaces in erlide, which I didn't
> got around to publishing as a standalone library. If you feel like checking
> it out, it's at
> https://github.com/erlide/erlide/tree/pu/org.erlide.util/src/org/erlide/util/erlang.
> If you think that these are useful or interesting, we can look at how to
> integrate them.
>
> Some differences are that I implemented pattern matching with something
> like
>        Bindings b = match("{ping, From:p, Message:l}", someInput);
>     // ':p' means is_pid and ':l' means is_list
>     OtpErlangPid pid = b.getPid("From");
>     Collection<OtpErlangObject> msg = b.getList("Message");
> which I find easier to read, but is a bit difficult to extend (for example
> with more advanced guards, which you can add easily).
>
> I also chose to convert terms to Java objects by using a type signature, à
> la printf. It is used for doing nicer looking RPCs to Erlang, for example rpc.call("mod",
> "fun", "ssolxi", ...args) will convert the args to (in order) two
> strings, a list of whatever ('x') and an integer.
>
> There is also a format function that looks like printf or io:format, but
> produces OtpErlangObjects instead:
> format("{hello, ~s, ~a, ~b}", "foo", "bar", "baz") --> {hello, "foo", bar,
> <<"baz">>}
>
> regards,
> Vlad
>
>
>
> On Thu, Apr 18, 2013 at 11:25 PM, Alex Arnon <> wrote:
>
>> Hi All,
>>
>> I am releasing the first version of Helperl, a convenience wrapper for
>> JInterface.
>>
>> Project home page (at Bit Bucket):
>> https://bitbucket.org/alexarnon/helperl
>>
>> The idea was to try and make JInterface usage almost pleasant, because
>> really guys, that API is still rocking all the hotness of Java 1.4.
>>
>> Helperl has been successfully used in integration experiments. However,
>> it is the first released version, and should be considered Alpha quality.
>>
>> Examples:
>>
>> * Construction of simple types, lists and tuples:
>>
>> --------------------
>>
>> 12345               <-  erl(12345)
>>
>> <<"hello">>         <-  erl("hello")
>>
>> 'hello'             <-  eAtom("hello")
>>
>> [12345, 'qwerty']   <-  erl(12345, eAtom("qwerty"))
>>
>> {ping, [123, 456]}  <-  eTuple(eAtom("ping"), erl(123, 456))
>>
>> --------------------
>>
>>
>> * Pattern matching:
>>
>> Match {ping, From, Message} where is_pid(From) and is_list(Message), and
>> extract the values.
>>
>>
>> --------------------
>>
>>   CompositePattern p =
>>         pAnd(
>>             pTuple( eAtom("ping"), p_("From"), p_("Message") ),
>>             pIsPid("From"),
>>             pIsList("Message") );
>>
>>   Map<String, OtpErlangObject> result = p.match(someInput);
>>
>>   if (result == null) {
>>       // No match.
>>   } else {
>>       // Extract!
>>       OtpErlangObject from = result.get("From");
>>       OtpErlangObject message = result.get("Message");
>>
>>       // ...
>>   }
>>
>> --------------------
>>
>> To download the source code and jars, please look at the Bit Bucket repo,
>> or check out Maven Central, using:
>>
>>   <dependency>
>>       <groupId>net.shambolica.helperl</groupId>
>>       <artifactId>helperl</artifactId>
>>       <version>0.2.0</version>
>>   </dependency>
>>
>> Note that the Maven artifact has a dependency on JInterface 1.5.6.
>>
>> Please feel free to provide feedback!
>>
>>
>> Cheers,
>> Alex.
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130419/4f457942/attachment.html>


More information about the erlang-questions mailing list