Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"temp" prefix and path oddities #111

Open
choptastic opened this issue Oct 25, 2016 · 0 comments
Open

"temp" prefix and path oddities #111

choptastic opened this issue Oct 25, 2016 · 0 comments

Comments

@choptastic
Copy link
Member

Regarding these line:

https://github.com/nitrogen/nitrogen_core/blob/master/src/lib/wf_render_actions.erl#L184-L189

wf:temp_id() returns a value like "temp12345", which is handled specifically by the above lines. This highlights a bit of a wart of Nitrogen, in that the prefix "temp" is treated specially as an element id. This is because most elements are expected to have an ID that's an atom, but due to Erlang's lack of atom GC, we cannot willy-nilly create atoms or we'd crash the VM.

So temp IDs are created as strings, and then the prefix "temp" is treated specially when wiring actions, leading to potentially unexpected behavior.

The current method works, but again, but can be confusing as to why wf:wire("temp1234", ...) successfully wires to an element with the ID temp1234, while wf:wire("foo1234", ...) will not work.

Need an elegant and consistent solution to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant