Closed UlyssesZh closed 3 years ago
I appreciate the suggestion, but I think of c//e
and c/>/c
as invalid syntax. It was only accepted in Alda 1 by accident. I realize this is a breaking change that we no longer accept it in Alda 2, but I think it's probably uncommon enough that it won't cause too much trouble for folks who may have done this in Alda 1 scores to fix their scores so that they'll continue to work in Alda 2.
I found a similar difference. In Alda 1, something like [c'1/e'1]*1
does not produce errors, but it does in Alda 2.
I experimented with that example in the Alda REPL for a bit, and I think that's another example of something invalid that Alda 1 allowed, and now Alda 2 rightly considers it invalid.
The '1
syntax is an example of variations. Any event (e.g. a note, a chord, an event sequence) can be followed by a single quote followed by either a number or one or more ranges of numbers separated by commas, like '1,2-4,7-9
. This designates which times through a repeated phrase that event should be included in the repetition. If the intent is:
Then the way to write this is:
[c/e'1]*1
The '1
signifies that the chord c/e
is to played on repetition number 1.
If you write this:
# invalid
[c'1/e'1]*1
The parser complains because you cannot say that only certain notes in the chord are to be played only on certain repetitions. You can only say that the chord is to be played only on certain repetitions.
Hopefully that makes sense!
In Alda 1,
c//e
is equivalent toc/e
and does not lead to an error, but in Alda 2, it will sayI think we should adopt the behavior in Alda 1. First, sometimes when we write music in alda, we suddenly want to delete a middle note in a chord. After deleting it, we want to let a simple mark to denote that there used to be a note. A double slash can be a good mark for this (maybe?). Second, in an Alda library, a chord can be defined as a list of events being connected with slashes. Then, if we want to represent something like
c/>c
, it is probably easier to write it asc/>/c
. This will unfortunately lead to the error, exclusively in Alda 2. Third, I think continuous slashes are probably not an intended feature in Alda (something like undefined behavior), but at least in consideration of backward compatibility, maybe we should make Alda 2 behave similarly to Alda 1.