Skip to content

Q: dealing with name conflict between scope object's fields and registered factories #2671

Answered by josdejong
evil-shrike asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks, interesting question.

The vague error message is really unfortunate, I've seen that more often. Would be nice to improve on that.

As for having multiple "things" with the same name: even if it is possible to change mathjs to allow a variable having the same name as a function, I think it's something that is best avoided since it leads to confusion. Similar to shadowing variable names in a programming language.

So I would say: just keep things simple and give one of the two a differing name so there is no conflict.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by josdejong
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2323 on August 17, 2022 12:37.