Closed kanghyojun closed 6 years ago
@admire93 Although PR #35 fixed it to work, we need to refactor the generated code to be conciser and more efficient than now.
__nirum_type__ = 'union' # or 'record'/'tag'/'enum'/'boxed'
so that the runtime can determine what Nirum type the given Python class is generated from.__nirum_tag_classes__ = {Tag.tag_name: TagName, ...}
so that the runtime can lookup the corresponding Python class by the given tag name in O(1). The current implementation loops over cls.__subclasses__()
which is O(n).
https://gitter.im/spoqa/nirum?at=57dd736133c63ba01a0e09e2