New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.1 Roadmap #7
Comments
1. [language] add with support [lang] 2. fix `finally clauses` in try statements 3. fix autogen for instance method binding. `self` argument should be considered in the argument count, when it comes to the instance method.
we keep only |
Intentionally not support |
CPython I'm going to drop magic methods like |
we drop |
If one day any python static analyzer supports defining custom semantics for the syntax At the current stage, it's doable to support them all, but this is a two-door design and causes unsolvable performance issues, which is the reason for not supporting them currently. |
NOTE: 'mkslice(int count) -> (int start, int step, int nstep)'
public static Stack<(TrStr, TrObject)> import_from_module(
[AllowNull] string module,
int level,
Dictionary<TrObject, TrObject> globals,
[AllowNull] string[] __all__
) |
Focusing on tests: #26 |
The unsupported features will be documented. |
A short intro to the architecture (you can escape this and see the roadmap)
We have five parts to implement:
language features. For instance,
import
statement is a lang feature. Such part includes PythonAST-to-TraffyASM compilation, and its interpretation in .NET side.related source code:
built-in functions and types: built-in functions like
print
,map
, and builtin types likelist
andException
related source code
runtime mechanisms, such as inline cache (for fast attribute reading and writing), coroutine implementations, traceback system, fast method call, etc.
backend code is more or less related to this topic, but for specific sub-topics:
The implementation of Python data model (objects, classes,
__init__
,__new__
, a lot) is roughly a duplicate of CPython, what I've done is just figuring out a maintainable and efficient approach.tooling, mainly about IDE support.
UnityPython.BackEnd/traffy-types/builtins.pyi
can instruct Pylance to analyze UnityPython source. When a new builtin is implemented, we should add type hints intraffy-types/builtins.pyi
to support the new stuffs.Unity/game engine: we will finally generate Unity API bindings for UnityPython.
Roadmap
language features
Most of the language features have been already supported, see
UnityPython.FrontEnd
.The complete Python ASTs are defined at Python 3.10 ASDL
What have been supported.
with
await
,async
,await Task.Yield
FormattedValue
,JoinedStr
(NOTE: ascii conversions ({x:a}
) and format specifiers ({a:.2}
) are not supported)attributes/subscripts:del a; del a[b]; del a.b
ListComp
,SetComp
,DictComp
,GeneratorExp
raise e
,raise
raise e from cause
runtime mechanisms:
__abs__
(TODO: addabs
builtin to call__abs__
)__enter__
__exit__
(the third argument of__exit__
is alwayNone
in UnityPython!)built-in functions and types (only the necessary ones are included)
builtin types
complex, memoryviewNOTE:
type
is the only metaclass in UnityPython!ref
: a UnityPython specific builtin, used for fast dictionary/attribute lookupclassmethod
staticmethod
property
:property.setter
,property.getter
NOTE:
fget
,fset
are exposed yet;property.deleter
is not implemented(not in the plan)
NotImplementedbuiltin exception types (https://docs.python.org/3/library/exceptions.html):
KeyboardInterruptGeneratorExitFloatingPointError (for future)builtin functions/callables (https://docs.python.org/3/library/functions.html)
iter
Task.Yield
(UnityPython specific): used foryield
inasync
functions, the semantic is waiting for the next event loop.print
map
,filter
abs
(__abs__
support?)all
,any
bin
callable
chr
,ord
,oct
,hex
getattr
,setattr
enumerate
hash
id(impossible to implement, at least cannot be an int)isinstance
,issubclass
range
repr
: handle circular references (e.g., a list contained in the itself, deep or shallow)reversed
round
super
sorted
sum
pow
zip
__import__
globals
,vars
,locals
,breakpoint
runtime mechanisms
inline cache
object fields are stored in arrays rather than in dictionaries; writing and reading attributes are using inline cache (see
IC.*.cs
) for fast interpreter and low memory assumptionerror positions in exception stacktrace
__init_subclass__
tooling/IDE:
Unity Modules
The text was updated successfully, but these errors were encountered: