473,560 Members | 2,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(In Rhino) Why Context.newObje ct() looking for constructors only in TopLevelScope?

This is "newObject" method from org.mozilla.jav ascript.Context class.

....
01 : public final Scriptable newObject(Scrip table scope, String
constructorName , Object[] args)
02 : {
03 : scope = ScriptableObjec t.getTopLevelSc ope(scope);
04 : Function ctor = ScriptRuntime.g etExistingCtor( this, scope,
05 :
constructorName );
06 : if (args == null) { args = ScriptRuntime.e mptyArgs; }
07 : return ctor.construct( this, scope, args);
08 : }
....

Why scope gets reset to point to TopLevelScope (line 03)?

Jul 23 '05 #1
2 1844
k0t1k wrote:
This is "newObject" method from org.mozilla.jav ascript.Context class.

<snip>

Generally the point of ECMAScript is that the author does not need to
know anything about how implementations of the language work. And doing
cross-browser work makes the specific implementations less significant
as they are not the same in different browsers. So long as the resulting
behaviour corresponds with ECMA 262 the internal details are not
important.

A good group for asking questions related to the Spidermonkey and/or
Rhino implementations is - netscape.public .mozilla.jseng -, as there
they may get the attention of the authors of those implementations .

Richard.
Jul 23 '05 #2
Thanks Richard, I will repost it there.

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4831
by: John Benson | last post by:
Hi, I'm in a tightly-secured environment where I may not be allowed to use Python for some scripting work, and may have to fall back on what came with Windows 2K. I'm cracking "VBScript in a Nutshell" from O'Reilly, and have found a number of disappointments: * can't find "Introspection" in the Index * no record types, just...
42
5724
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same kind. It sounds simple but evidently .NET has difficulty with this concept for some reason. I do understand that .NET objects are created on the GC...
10
1592
by: Brett Foster | last post by:
Perhpas somebody can give me a hand with this little problem. Given: var object; -- an object var func; -- a function call back Now, I want to know how to get the following effect: object.func = func;
4
1338
by: Jamie B | last post by:
Is it possible to use System.Type, Activator or whatever to create a complete "blank", unitialized object of a given type, and then at a later time call a constructor on it. The only caveat is that before I call the constructor I still want the object to correctly return its type if GetType() is called. If its possible, how do I create the...
10
1744
by: John | last post by:
Trying to find out what is essential / optional, I made an extremely simple Class and Module combination to add two numbers. (see below) It appears that an empty constructor is needed n order to work right, although I quite don't see what is does in addition to the 2nd constructor. Also, the example works fine without message calls in...
5
4563
by: Anders Borum | last post by:
Hello! Whilst refactoring an application, I was looking at optimizing a ModelFactory with generics. Unfortunately, the business objects created by the ModelFactory doesn't provide public constructors (because we do not allow developers to instantiate them directly). Because our business objects are instantiated very frequently, the idea...
7
16535
by: andrewfsears | last post by:
I have a question: I was wondering if it is possible to simulate the multiple constructors, like in Java (yes, I know that the languages are completely different)? Let's say that I have a class called "Point" which would have two values "x" and "y". Now, let's say if it were the Java version, I would want two constructors: one that...
3
4587
by: jackchang1 | last post by:
Hi I want to develop a Java application to check the syntax of Javascript code and I am thinking about using Rhino. But I don't know where to start and there is no document for this. Has anybody done this before? or can Rhino be embedded in my Java application to check the syntax of JavaScript code? I thought it is possible. Thanks!
1
1663
by: Kwang Yul Seo | last post by:
Hi all, I am looking for JavaScript libraries based on JavaScript Core Library (http://www.webreference.com/javascript/reference/core_ref/ contents.html) without using client-side JavaScript. Is there any useful project?
0
7635
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7556
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7600
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7921
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5459
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
882
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.