Unsafe variable warning

47 views
Skip to first unread message

Marcel Otto

unread,
Sep 12, 2017, 7:38:50 PM9/12/17
to elixir-lang-core
Let me first of all state, that I fully support this warning type. I find it good, that Elixir tries to guide developers in a generally right direction, but with the JSON-LD.ex project, I find myself in a situation where I think it's not. 

JSON-LD.ex is an implementation of the JSON-LD W3C standard, particularly its processing algorithms. For this type of library, IMO maintainability is measured against the ability to conform the wording of the spec. The processing algorithms are quite complex and unfortunately specified in a very imperative style with many assignments in deeply nested conditionals. In the beginning, I fixed the warnings but found that this reduces the maintainability: I want to look at a numbered chunk of code and be able to easily compare it to the specs, to check if the implementation is correct or to adapt to changes in the spec (like the upcoming JSON-LD 1.1). So I discarded the fixes and started to ignore these warnings. Unfortunately, I'm now flooded with these warnings, which makes the whole warning system actually useless for this project. 

I've noticed this issue where this warning was already questioned, but at the same time making warnings optional ruled out in general. So, I'd like to know the current status and how I should proceed. I've already got a pull request that fixes the warnings, but I hesitate to merge it for above reasons.


José Valim

unread,
Sep 13, 2017, 3:13:00 AM9/13/17
to elixir-l...@googlegroups.com
I would say it was a coincidence you were able to port imperative algorithms to Elixir as is. The imperative assignment has always been a source of confusion, especially because different forms would behave differently in exporting variables, so we are glad this behaviour is deprecated.

As stated in the linked issue, some very few warnings will be converted to errors on Elixir 2.0, and this is one of them. That's because implementing this behaviour actually adds a lot of complexity to the compiler. There are some improvements and optimizations that we are currently unable to do because of this feature and they are being help back for Elixir 2.0.

Elixir 2.0 is not coming any time soon but, when it eventually arrives, it is safe to say this "feature" will no longer exist.



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

--
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-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/cfa222ff-64b8-4234-9f6b-c0035ec8ee27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages