[proposal] Allow module attributes in binaries length

45 views
Skip to first unread message

Jakub G

unread,
Nov 2, 2018, 9:33:43 AM11/2/18
to elixir-lang-core
We can use <<5 :: 4>> or <<10 :: 4*3>> to control our binaries' size. 
Why can't we use modules attrib (which are const) to do it? I was kinda suprised this didn't work: <<5 :: @some_attrib * 2>>

Wojtek Mach

unread,
Nov 2, 2018, 9:38:54 AM11/2/18
to elixir-l...@googlegroups.com
Perhaps worth mentioning that in order for it to work today it needs to be written as:

<<5::size(@some_attrib)-unit(2)>>


On 2 Nov 2018, at 14:33, Jakub G <jump...@gmail.com> wrote:

We can use <<5 :: 4>> or <<10 :: 4*3>> to control our binaries' size. 
Why can't we use modules attrib (which are const) to do it? I was kinda suprised this didn't work: <<5 :: @some_attrib * 2>>

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/683a6227-525c-4693-a56a-4d6ea64f48df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

José Valim

unread,
Nov 2, 2018, 9:41:38 AM11/2/18
to elixir-l...@googlegroups.com
Definitely a bug. Please open a bug report.
--


José Valim
Skype: jv.ptec
Founder and Director of R&D

Jakub G

unread,
Nov 2, 2018, 9:43:55 AM11/2/18
to elixir-lang-core
I found this issue, is related? https://github.com/elixir-lang/elixir/issues/6273

José Valim

unread,
Nov 2, 2018, 9:45:09 AM11/2/18
to elixir-l...@googlegroups.com
No, that’s a separate one. :)
Reply all
Reply to author
Forward
0 new messages