Skip to content

Conversation

emlyn
Copy link
Contributor

@emlyn emlyn commented Feb 22, 2024

This change makes the range function return integers if all arguments are integers.

I don't think this should break anything, since the values returned should be unchanged,
and I think integers should be accepted anywhere floats are expected.

This would allow things like the following to work:

live_loop :foo do
  sample "drum", range(2, 6).tick
  sleep 0.5
end

Currently that fails with an error like: Unknown sample filter type: Float - got: 2.0 (RuntimeError),
which can cause confusion (see e.g. https://in-thread.sonic-pi.net/t/force-integer-from-a-range/8625/1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant