Restricting A Function To Be In Scope of Constructor Method

R

Richard Cornford

John said:
VK writes:


<snip>

Could you say, clearly and in not many words and with no
irrelevant examples, what this incontinence is.

The evidence suggests that he cannot.


Richard.
 
V

VK

John said:
Could you say, clearly and in not many words and with no irrelevant
examples, what this incontinence is.

That really was discussed N times in this newsgroup, and I believe that
you were participant of at least few of the relevant thread. But maybe
my progressing insanity (so properly diagnosed by Ph.D. Cornford :)
affecting my memory either.

In the requested minimum of words:
"incontinence of <this>" refers to a set of situations when - due to
ECMAScript engine specification bugs - <this> points to the expected
object at the moment of initialization/assignment but does point or may
point to a unexpected object a step later.

<http://www.crockford.com/javascript/private.html> will get you on hold
of the most known one. After you are done and if willing to continue
we'll move on ontimer calls.
 
R

Richard Cornford

VK said:
That really was discussed N times in this newsgroup,

The question ahs certainly been asked many times, but you never manage
to answer it.

In the requested minimum of words:
"incontinence of <this>" refers to a set of situations when - due to
ECMAScript engine specification bugs - <this> points to the expected
object at the moment of initialization/assignment but does point or may
point to a unexpected object a step later.

In a language that determines the value for - this - always, and only,
by how a function is called the - this - value should be expected to
differ depending on how a function is called, and so not necessarily be
the same at the point where a function is defined (and/or assigned) and
the point where it is called. Indeed the - this - value could not even
be assumed to be the same if the same function is called in two
different ways.

It may also be worth mentioning that as - this - in the global
execution context refers to the global object the implication of your
desire that - this - refer to the same value when a function is called
as when it is initialised/assigned is that in constrictors defined in
the global scope, and methods assigned to their prototypes in the
global scope (as they normally are), and as all inner functions must
then be declared/evaluated inside these global functions, is that -
this - would always refer to the global object inside all constructors,
methods and functions. Effectively making the - this - value worthless.

But once again all you are saying here is that because you do not
understand how the - this - value works you are incapable of expecting
it to refer to the values it does refer to, and in not being abler to
expect what you get you see what you get as in some sense
"incontinence", rather then the consistent product of predictable
mechanical logic that it actually is.

The - this - keyword always points to the 'expected' object, you just
need to understand the mechanism before you can have the correct
expectation. That may be beyond you personally, but that has no
implications for the language (or anyone else's ability to understand
it).
<http://www.crockford.com/javascript/private.html> will get you on hold
of the most known one. After you are done and if willing to continue
we'll move on ontimer calls.

You mean the things where string arguments are evaluated in the global
scope and function reference arguments are called as values, giving
completely predictable values for - this - in those contexts?

Richard.
 
V

VK

Richard said:
The - this - keyword always points to the 'expected' object, you just
need to understand the mechanism before you can have the correct
expectation.

Richard, it is a mute point, we tried it before. To even discuss "what
is wrong" it is needed first to agree that there is something wrong
around. In application to an ECMAScript-compliant behavior in order to
agree that something is wrong around it is necessary first to accept
that something can ever be wrong with official specifications.
This is why some agreement on the bug definition was a necessary lemma
to move on ("lemma" in the sense that it is not practically so
important, but it allows to prove other practical things later).

Your definition of a "bug" and "official specification" simply exclude
any existence possibility of problems like the one with <this>. That is
going to be another chain of my samples and your detailed explanations
why it is fully conforming to the existing specs (which is the point I
am not arguing with).
 
R

Richard Cornford

VK said:
Richard, it is a mute point, we tried it before. To even
discuss "what is wrong" it is needed first to agree that
there is something wrong around.

There is something wrong around; your expectations differ from reality
("may point to a unexpected object").
In application to an ECMAScript-compliant behavior in
order to agree that something is wrong around it is
necessary first to accept that something can ever be
wrong with official specifications.

On the contrary, not corresponding with the specification is virtually
the only criteria that could be applied if trying to declare that
something is wrong with "ECMAScript-compliant behaviour".
This is why some agreement on the bug definition was a
necessary lemma to move on ("lemma" in the sense that
it is not practically so important, but it allows to
prove other practical things later).
Gibberish.

Your definition of a "bug" and "official specification"
simply exclude any existence possibility of problems like
the one with <this>.

Your "problems like the one with <this>" have existence, but it is an
existence limited to the inside of your head. Everyone else can lean to
have expectations about the - this - value that correspond with reality.
For you your misconceptions is more significant than reality and so for
you the - this - value will often be unexpected. Neither the
specification nor the implementations are at fault in that.
That is going to be another chain of my samples and your
detailed explanations why it is fully conforming to the
existing specs (which is the point I am not arguing with).

Gibbering incoherently is a symptom of mental illness.

Richard.
 
J

John G Harris

The question ahs certainly been asked many times, but you never manage
to answer it.



In a language that determines the value for - this - always, and only,
by how a function is called the - this - value should be expected to
differ depending on how a function is called, and so not necessarily be
the same at the point where a function is defined (and/or assigned) and
the point where it is called. Indeed the - this - value could not even
be assumed to be the same if the same function is called in two
different ways.
<snip>

Good heavens! So that's what he's trying to say. Well, well!

Does he object to ordinary function calls, such as a.b.c(), or to new
expressions, such as new Thing() ?

John
 
R

Richard Cornford

John said:
Richard Cornford writes
Good heavens! So that's what he's trying to say. Well, well!

Does he object to ordinary function calls, such as a.b.c(),
or to new expressions, such as new Thing() ?

It is unlikely that VK has any sort of expressible concept of what he
objects to. The vague suggestion that - this - should always refer to
the same object inside a function call as it refers to when the function
is created ends up with - this - always referring to the global object,
which hardly expands its usefulness. Probably his mind doesn't go beyond
"I want it to be exactly how I think it should be at any pint I wish to
use it, and everything else is wrong".

A proposal sufficiently logically consistent that it could even be
implemented is about the last thing that would be expected of VK.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top