PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Languages/IronPython/Tests/interop/net/method/__init__.py

#
Python | 137 lines | 84 code | 1 blank | 52 comment | 0 complexity | ed68794c909d112f52fc32373e0a7bbb MD5 | raw file
  1#####################################################################################
  2#
  3#  Copyright (c) Microsoft Corporation. All rights reserved.
  4#
  5# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
  6# copy of the license can be found in the License.html file at the root of this distribution. If
  7# you cannot locate the  Apache License, Version 2.0, please send an email to
  8# ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
  9# by the terms of the Apache License, Version 2.0.
 10#
 11# You must not remove this notice, or any other, from this software.
 12#
 13#
 14#####################################################################################
 15
 16'''
 17General
 18* Where it is defined
 19* How it is defined
 20  - Static and instance 
 21  - Explicit interface method implementation
 22  - Virtual, new, override
 23
 24Passing arguments with different parameter lists
 25In C#, 
 26    public void M1(int x, int y) { }
 27    public void M2(int x, params int[] y)
 28    public void M3(int x, [DefaultParameterValue(5)] int y)
 29    public void M6([Optional] int x, [Optional] object y) 
 30    public void M7([Out] int x) 
 31    public void M7([ParamsDictionary] IattributesCollection dict) 
 32* Methods with  
 33  - one of such special parameter, 
 34  - two of such special parameters
 35  - one normal, the other special parameter. And different orders.
 36  - 3+ parameters with mixed kind
 37* Where DefaultParameterValue/Optional Attributes are not the last parameters.
 38* Different parameter types - string, int, Boolean, Object, self-defined 
 39  struct, class, variables.
 40* Check optional (missing) value
 41* Argument name are language special:
 42  - (python) True, def
 43* Params as an intermediate parameter (only via params setter?  Or also via 
 44  IL or direct attr?)
 45(Python)
 46* try with different parameter lists:
 47  - positional argument, 
 48  - keyword argument, 
 49  - *tuple style, 
 50  - *dictionary style, 
 51  - Mixed of them.
 52* Argument for the default value parameter (provide, not provide...)
 53* Negative scenarios
 54  - "params" could not be "keyword" argument?
 55  - Provide parameter more than once (such as positional, and keyword...)
 56
 57Passing arguments for By-ref parameters
 58In C#,
 59    public void M1(int x, ref int y) { ... }
 60    public void M2(int x, out int y) { ... }
 61* Methods with
 62  - Similar aspect as the previous scenario
 63  - Consider mixing with default value/ params arguments
 64  - Ref, out parameters are not at last.
 65* Same for constructor.
 66(Python)
 67* call each of them with different parameter lists (similar to previous matrix)
 68* pay attention to: 
 69  - clr.Reference
 70  - Whether you need pass argument
 71  - What kind of argument
 72  - Mix&match is not supported
 73* Negative scenarios. 
 74
 75Method Overloads
 76* Related to method signatures
 77* Related to argument values/types
 78* (python?) Related to return values (specifically conversions on returns, 
 79  nullable types, etc...)
 80* Methods with different parameters
 81* Non-generic / generic methods have the same name 
 82  - Activator.CreateInstance scenario
 83  - G<T>.M(int), G<T>.M(T)
 84  - G.M(int), G.M<T>(T)
 85* Static method and instance method have the same name
 86  - instance M(C), static M(thisType, C)
 87* Same name as explicit interface method
 88
 89Operator Overloading
 90* all supported overloads (well-behavior)
 91  - http://msdn2.microsoft.com/en-us/library/2sk3x8a7(vs.71).aspx 
 92* unary/binary overloads (not defined as usual)
 93  - positive
 94    * instance method
 95    * static method where the first parameter is not the declaring type
 96    * has CodeContext as the first argument
 97  - negative
 98    * unary operator has  0, 2, 3 parameter
 99    * binary operator has 0, 1, 3 parameters
100* Call the operator explicitly
101* Provide one-side comparison operator overload, but access the reverse-side 
102  operator
103* Provide simple operator overload, but call in-place operator	
104* Overloads 
105* Value type which has operator overloads
106* Something Python is unable to practice:
107  - op_Assign, ...
108* Something decorated with special attribute (GetItem, GetBoundMember...)
109(Python)
110* __xxx__ call style
111
112User-defined conversions
113* TODO
114
115Implicit conversion operator
116* Where it is applied: only passing as argument to method
117* Where it is defined:
118  - Value type, reference type, generics 
119* How it is defined: 
120  - Instance op_Implicit method
121  - Overload scenario
122* (python) Implicit vs. Explicit: when do we use what
123* C#: http://msdn2.microsoft.com/en-us/library/aa691280(VS.71).aspx 
124  - Implicit enumeration conversions 
125  - Implicit reference conversions 
126  - Boxing conversions 
127    * Check the pass-in value/identity?
128  - User-defined implicit conversions
129    * Builtin number/char/string/bool/enum -> class/struct 
130    * Class/struct -> class/struct 
131    * Generic types (G<T>, G<int>, GOfInt, G<K, V>)
132    * Conversion among base/derived types
133
134Explicit conversion operator
135* Not supported by the language yet, tracking as bug 314284
136* (python) __int__, __long__, __float__, __complex__, __nonzero__
137'''