Meaning of the term "context" in programming
Hello guys, I was reading a few things and I noticed several time the words "depends on the context" is used. What does the term context refers to in programming please
18 Replies
it usually means "scope" or "execution scope"
hmm is there a difference between scope or execution scope pls
it's the same
sorta
for example, the same function can be used in multiple event listeners
the function is a scope, the executing scope is the scope that's being executed in
Hmm I read that "this" keyword is "context-based" what does this mean ?
for example in javascript, I understand that "this" keyword refers to current instance of an object, but I'm kind of confused about the term "context-based" :c don't know if it's my english which is bad😭
it is
and you can even change what the
this
isyeah when we change this, we are basically changing "context"
I don't like this word "context" I need another technical word
it's the best word to be used
Ok so I just GPT it, context can refers to:
Scope/ Instance/ State
Yeah but I don't know, when I read the term "context" my brain doesn't assimilate it 😭
I don't know how to make sense of this word 😦
state is different from context
state is state
instance is different from context
instance is a "copy" of an initialized object
yeah true, have another alternative:
"The specific situation or environment in which code is running or being used."
is this one correct pls
no, because the same code running in the same environment can have COMPLETELY different execution scopes
or, in this case, context
imagine a resize handler that's triggered for 20 elements
just imagine
same code, same environment, same situation ... even is being executed by the exactly exact same trigger
but, the context is different
yeah because each element is a different context?
yes
but not just that
external variables can have different values too
ah
I see
so, how would you define "context" once more? 😂
execution scope makes more sense I think
it's what context is
alright, will stick with "Execution scope" then
by the way, Happy new year @ἔρως !!!
happy new year
@Faker please note that this channel is for code-specific questions. This question is better suited to #discussions . In the future, please use that channel for such discussions.