PageRenderTime 22ms CodeModel.GetById 18ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/interpreter/tags/at_build150307/src/edu/vub/at/objects/grammar/ATDefExternalMethod.java

http://ambienttalk.googlecode.com/
Java | 69 lines | 8 code | 4 blank | 57 comment | 0 complexity | f9c7708f69d894f0334d13847eef0536 MD5 | raw file
 1/**
 2 * AmbientTalk/2 Project
 3 * ATDefExternalMethod.java created on 15-nov-2006 at 19:23:51
 4 * (c) Programming Technology Lab, 2006 - 2007
 5 * Authors: Tom Van Cutsem & Stijn Mostinckx
 6 * 
 7 * Permission is hereby granted, free of charge, to any person
 8 * obtaining a copy of this software and associated documentation
 9 * files (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use,
11 * copy, modify, merge, publish, distribute, sublicense, and/or
12 * sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following
14 * conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */
28package edu.vub.at.objects.grammar;
29
30import edu.vub.at.objects.ATTable;
31
32/**
33 * @author tvc
34 *
35 * The public interface to an external method definition abstract grammar element.
36 * Created when evaluating <tt>def o.m() { body }</tt>
37 * 
38 * There are three ways to evaluate such expressions with respect to what context should be
39 * active when the method is invoked upon the object:
40 *  1) The newly defined method is wrapped in a closure thereby fixing the lexical scope that was
41 *     active at method definition/addition time, as well as the values of 'self' and 'super'.
42 *     This has the advantage that within the externally added method body:
43 *      a) the adding object can still access its lexical scope.
44 *      b) the adding object can *not* access the scope of the object it is adding a method to.
45 *     This has the disadvantage that within the externally added method body,
46 *     'self' and 'super' keep on referring to the lexically active self and super. This has the
47 *     disadvantage that the newly added method cannot perform 'super sends', nor is the value of
48 *     'self' correct when the method is invoked through a child of o.
49 *  2) The newly defined method is added as-is to the object. This has roughly the reverse
50 *     effects of option 1: the adding object loses its lexical scope (error-prone and dangerous!)
51 *     but the values for self and super are correct. It is as if the method was really defined
52 *     in the scope of the original object.
53 *  3) The newly defined method is wrapped in a special 'objectless' closure that captures the
54 *     lexical scope of the adding object but *not* the values of 'self' and 'super'. When the
55 *     added method is subsequently invoked, its lexical scope will still be that of the adding
56 *     object (hence, having the benefits of option 1) while the values of 'self' and 'super'
57 *     will be correct with respect to the method invocation on o (or a child of o) (hence,
58 *     having the benefits of option 2).
59 *     
60 * AmbientTalk implements the third option, by means of a NATClosureMethod.
61 */
62public interface ATDefExternalMethod extends ATDefinition {
63
64	public ATSymbol base_getReceiver();
65	public ATSymbol base_getSelector();
66	public ATTable base_getArguments();
67	public ATBegin base_getBodyExpression();
68	
69}