question about This

Matt Neuburg matt at tidbits.com
Sat May 18 12:56:40 PDT 2002


On Sat, 18 May 2002 13:30:50 -0400, Brian V Hughes <brianvh at dartmouth.edu>
said:

>I totally agree that "this" should never be undefined in the context
>of a running script, but I've never seen it be undefined, and I
>haven't seen anyone else say they have either.

Oh, all right, here. Make a #tools script called getThis, as follows:

  script.newscriptobject("return this", @tools^.myWeirdScript);
  return myWeirdScript()

Make a web page object that goes:

  {getThis()}

That works when rendering statically but not when rendering dynamically.

Now, I admit this is an odd thing to do, but that's not the point. After
all, if I weren't pushing at the envelope the matter wouldn't arise. My
point is simply that the script myWeirdScript must be somewhere - we know
that, because getThis can call it - so I think it's perfectly reasonable to
ask it *where* it is. It's a script, so "this" should not be undefined.

m.
-- 

matt neuburg, phd = matt at tidbits.com, http://www.tidbits.com/matt
pantes gar anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/



More information about the Frontier-Users mailing list