<div class="gmail_quote">2009/5/13 Davide Marquês <span dir="ltr"><<a href="mailto:nesrait@gmail.com">nesrait@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi there!<br><br><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
Where can I find some indications on how to define a type specifier so in my module I can have some new types like:<br>
<br>
<<Value:Size/huffman,..>><br>
or<br>
<<Value:Size/fibonacci,..>><br>
or<br>
<<Value:Size/base64,...>><br>
or any custom encoding method for that matter.<br>
<br>
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.<br>
I have looked into unicode.erl (in R13B source code) but haven't seen anything relevant to answer my question.</div></blockquote></div><div><br>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*. :)<br>


With that in mind, parse_transform looks like the tool for the job!<br>Using it you could specify those new fancy types and have them turned into the [existing] 'binary' type on compilation<br>(more experience folks, what do ya think?).</div>

</div></blockquote><div><br>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.<br>

<br>Robert<br><br></div></div>