[erlang-questions] custom type specifier
Costin-Tiberiu RADU
costin.tiberiu.radu@REDACTED
Fri May 15 10:36:49 CEST 2009
Thanks for the information.
Yes, I would like to use the custom type specifiers in my modules.
Regards
--
Costin-Tiberiu RADU <costin.tiberiu.radu@REDACTED>
În data de Mi, 13-05-2009 la 15:57 +0200, Robert Virding a scris:
> 2009/5/13 Davide Marquês <nesrait@REDACTED>
>
> Hi there!
>
>
> Where can I find some indications on how to define a
> type specifier so in my module I can have some new
> types like:
>
> <<Value:Size/huffman,..>>
> or
> <<Value:Size/fibonacci,..>>
> or
> <<Value:Size/base64,...>>
> or any custom encoding method for that matter.
>
> My question may seem (and probably is) pretty trivial,
> but I am new in writting code with erlang and some
> things are not pretty easy to find if you do not know
> where to look.
> I have looked into unicode.erl (in R13B source code)
> but haven't seen anything relevant to answer my
> question.
>
> I'll assume your don't really want to extend the
> language/compiler to support those new type specifiers and
> only want them *in your modules*. :)
> With that in mind, parse_transform looks like the tool for the
> job!
> Using it you could specify those new fancy types and have them
> turned into the [existing] 'binary' type on compilation
> (more experience folks, what do ya think?).
>
> I suppose it depends on whether the type specifiers are expected to
> *do* anything. If so there are no provisions for adding custom
> encodings. It is not trivial to add encodings to the handling of
> binaries. There might also be some difficulty in describing what they
> are supposed to do.
>
> Robert
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090515/d76f89e6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Aceast fragment din mesaj este semnat digital
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090515/d76f89e6/attachment.bin>
More information about the erlang-questions
mailing list