Skip to content
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

Support lazy evaluation for member access, item access and function call #132

Merged
merged 3 commits into from
Jul 6, 2015

Conversation

unnonouno
Copy link
Member

I implemented GetAttr, GetItem, and Call classes which are sub-classes of Expr. These classes evluate __getattr__, __getitem__ and __call__ in expr. And old special classes like Shape are replaced with combinations of these classes.

For example this code is valid:

>>> s = Constant('xyz')
>>> s[1].__len__().eval()
1

In this situation, first Call(GetAttr(GetItem(Constant(...), 1), '__len__'), ()) is created, and then it is evaluated.

fix #131

I added general three types of exprs:
- GetItem for __getitem__ method
- GetAttr for __getattr__ method
- Call for __call__ method

Instead I removed speciall classes such as DTypeExpr and Shape.
These classes are replaced with GetItem and GetAttr.
@beam2d beam2d self-assigned this Jul 6, 2015
@beam2d
Copy link
Member

beam2d commented Jul 6, 2015

LGTM!
LGTM

beam2d added a commit that referenced this pull request Jul 6, 2015
Support lazy evaluation for member access, item access and function call
@beam2d beam2d merged commit c3eb035 into master Jul 6, 2015
@beam2d beam2d deleted the lazy-eval branch July 6, 2015 06:53
@okuta okuta modified the milestone: v1.1.0 Jul 7, 2015
@unnonouno unnonouno added the cat:enhancement Implementation that does not break interfaces. label Jul 7, 2015
okuta pushed a commit to okuta/chainer that referenced this pull request Jul 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:enhancement Implementation that does not break interfaces.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make a lazy evaluation mechanism for type check
3 participants