Skip to content

"temp" prefix and path oddities #111

@choptastic

Description

@choptastic

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions