Skip to content

E2: Remove duplicate directive error for includes? #1494

@shadowscion

Description

@shadowscion

Talking about these errors here:

Directive (@persist) contains multiple definitions of the same variable

It would be great if the limitation could be removed when including a file, barring any technical reasons for having it there. As it is now, cross-including and libraries that need to span multiple files (that have to use the same variables) are not easy to write or convenient to use.

Edit:
I'm not always the best with words, so I'm going to post an example from the discord by Divran as to why I think this should be considered:

if multiple includes add different feature sets of the same main functionality, but having all of them is not required. you can pick and choose which includes you want in your project because all of them will define the variables

and also

the multiple def check does literally nothing. its only there to help you fix mistakes in your code
because at the time it was made, includes didnt exist
but now that includes exists we can change it to only say this if you have multiple defs of the same variable name but different types, so if one file has @persist A:vector and another file has @persist A:angle then that's a conflict and should be fixed

Currently there are ways around this limitation (such as defining the variables ahead of the main code in each file) but they are not very pretty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E2This issue is related to E2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions