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

Impure range expressions #1397

robinsierra opened this issue Apr 17, 2019 · 1 comment · Fixed by #1424

Impure range expressions #1397

robinsierra opened this issue Apr 17, 2019 · 1 comment · Fixed by #1424


Copy link

@robinsierra robinsierra commented Apr 17, 2019

Version Information

  • vyper Version: 0.1.0b9
  • Tested with Remix IDE

Currently Vyper allows range expressions of the form range(x, x + n) where n is a constant. A weird case happens when x is impure:

glob: int128

def foo() -> int128:
	self.glob += 1
	return 5

def bar():
	for i in range(, + 1):

Even though the range expression contains two calls to it is only executed once, which feels very unintuitive at best. In general, it would be nice to have some documentation for loops/range expressions (especially if this is the intended behavior).


This comment has been minimized.

Copy link

@jacqueswww jacqueswww commented May 2, 2019

I agree, I don't think this should be allowed at all, ie. functions called in range() have to be @constant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.