Questions tagged [name-collision]

Within the context of computers and computer programming, "name collision" is the technical term for an instance in which two items have the same name within some logical enclosure. A name collision can occur in many instances, such as with the names of files in a directory, or in a program in which local variables in a function have the same name as some global variables.

The term "name collision" has been used in computer science for more than 3 decades, when referring to names in various classification systems. Most of the time, a name collision must be resolved immediately in some way, whether automatically by an operating system or compiler or manually through user input and decisions. The concept of a namespace sometimes resolves collision issues by creating different logical regions in which items with similar names can co-exist without ambiguity. In certain programming instances, a name collision might not be immediately evident, occasionally leading to hard-to-find program errors that can result from the compiler making certain assumptions about the names of items used.

An example of how a name collision can occur involves two directories full of files. If each directory contains a file named "DATA", and the contents of one directory are copied into the other, then the computer's attempts to copy the file named DATA will find that a file with the same name already exists in the target directory. This creates a name collision. In this instance, the user usually will be prompted and allowed to choose from a list of resolutions, including renaming one of the files, not copying the file or overwriting one of the files.

One commonly used solution for a name collision is the implementation of namespaces. A namespace is simply a way to define an area under which object names are contained. In the above example, a directory technically is a namespace, meaning multiple files can all have the same name as long as they are each in different directories.

From a programming perspective, a name collision can occur in situations such as multiple inheritance, overlapping variable scopes, or even with imported libraries in some languages. In general, a compiler will notice a conflict and generate a warning or error, although this might not always be the case. Other than using namespaces, collisions in many programming languages can be avoided by using qualifiers. A qualifier usually is a prefix that can be placed in front of a variable or class name to distinguish it from another variable with the same name.

75 questions
2
votes
1 answer

VBA - Naming and Instantiating a Class Module

Consider the Class Module named: MyClass It can be instantiated with early binding using: Dim cls As MyClass Set cls = New MyClass But one could instantiated with: Dim MyClass As MyClass Set MyClass = New MyClass Thus you work with an object with…
Michael
  • 87
  • 1
  • 1
  • 8
2
votes
3 answers

"column ambigiously defined" error

I have a query like this: SELECT * FROM table1 ref1, table1 ref2, table2 ref3, table2 ref4, table3 WHERE ref3.a = ref1.b , ref4.a = ref2.b , ref3.c = f, ref4.c = d and it works great, it gives…
steinbitur
  • 331
  • 4
  • 9
  • 18
2
votes
2 answers

Access VBA: SQL query causes UPDATE syntax error

I have a database with linked tables- Staff, Courses and Training_Record. Each staff member has a numeric primary key, as does each course and each entry in the Training_Record table. The Staff_ID and Course_ID in the Training_Record reference…
lhparker
  • 23
  • 1
  • 1
  • 3
1
vote
1 answer

how to run identical javascript functions

after extensive research i couldn't find an answer that fitted my (fairly) low skills in javascript. it'd be a great relief if any of you could help. i'm trying to run this script twice on the same page but i think the problem is the function…
1
vote
1 answer

How should I avoid name collisions between temporary tables in BigQuery sprocs?

Sometimes it's useful to create a temporary table within a BigQuery stored procedure, in order to store an intermediate result. However, I've run into an error due to a name collision between a temporary table in a sproc and one in the session…
1
vote
1 answer

Namespace Collision when file name and variable name match?

I'm running into a bug that only happens intermittently. Let's say I'm importing a function from a file boats.js // boats.js export function inspectBoat(boats) { console.log(boats); return true; } // ocean.js import { inspectBoat } from…
ahkvark
  • 11
  • 3
1
vote
1 answer

React MUI Class name collisions when using a library

We integrated a library into our Creatives project similar to how is being used in one of our pages. I noticed that when i interact with a graph there are lots of empty