[erlang-questions] Records / Proplists / JSON / BSON

Steve Strong steve@REDACTED
Mon Jun 17 10:29:44 CEST 2013


Thanks for the pointers to piqi, it looks close to what I was looking to build.  However, I've been playing a little and can't seem to express some of the constructs that we regularly use, for example we use tuples quite a lot for simple things such as ratios, so I may have a record such as: 

-record(foo, {
ratio :: {integer(), integer()},
%% other stuff here
}).

piqi certainly doesn't have support for these out of the box, but I'm also struggling to see how I can define one as an extension.  I'm trying to provide a mapping from an Erlang tuple to a piqi list; it wouldn't be perfect, since piqi doesn't know the list should be precisely 2 long, but it would be good enough.  I can get piqi to make calls to custom code where I can do the tuple <-> list mapping, but the generated .hrl file ends up with the primitive piqi type (so list(integer()) ) rather than my erlang type ({integer(), integer()}).   This would likely upset Dialyzer quite a lot ;) .  Any piqi gurus out there have any hints?

Cheers,

Steve

-- 
Steve Strong
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Monday, 17 June 2013 at 07:01, Vincent Siliakus wrote:

> Op zondag 16 juni 2013 23:48:21 UTC+2 schreef Richard A. O'Keefe het volgende:
> > 
> > There's another approach. 
> > 
> > Define your own "record" language, 
> > and generate the Erlang code (*including* -record declarations) from that. 
>  
> > And if you go down that route, be sure to first checkout the Piqi project at : 
> http://piqi.org
> 
> -vincent
> 
>  
>  
>  
>  
>  
>  
>  
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED (mailto: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/20130617/74e8762c/attachment.htm>


More information about the erlang-questions mailing list