Removing Microsyntaxes in favor of explicit attributes #293
Replies: 6 comments 9 replies
-
Possibly the proposal better allows something like https://json-schema.org/ to be used for validation of documents? |
Beta Was this translation helpful? Give feedback.
-
I agree that we should avoid inventing microsyntaxes just for the sake of it, but it may be worthwhile in some situations. The particular examples you raise as being difficult to handle as microsyntax would also be difficult to handle in a native form. Maybe not quite as difficult, but difficult nonetheless. Consider this simple example:
In this case the native form is perfectly readable, so the fact that the microsyntax form looks a bit nicer probably doesn't justify the increased programming complexity needed to parse it. But the native form doesn't scale to cope with more complicated time signatures. Consider this example:
We can't split this into a single numerator and denominator, so we end up requiring a native form that is almost as complicated to parse as the microsyntax. Maybe something like this in JSON: // Possible native JSON representation
{
"time-signature": [
{ "numerator": 1, "denominator": 2 },
{ "numerator": [ 2, 3 ], "denominator": 4 }
]
} Besides the increased visual complexity, we also see that:
These discrepancies could cause parsers to trip up just easily as unexpected microsyntax. Admittedly, it is still probably a bit easier to parse the native version than the microsyntax, but not by a huge amount. In this case it might be worth suffering a small increase in programming complexity in return for a microsyntax that is cleaner and more flexible. |
Beta Was this translation helpful? Give feedback.
-
Honestly, I don't see any good reason for using microsyntaxes.
I stongly favor removing microsyntaxes. |
Beta Was this translation helpful? Give feedback.
-
Given the reorientation of MNX towards parser/generator friendliness I think it would be consistent to remove microsyntaxes. I originally proposed them with human compatibility top of mind but with the move to JSON that goal has changed. |
Beta Was this translation helpful? Give feedback.
-
An update on this: We've removed the time signature microformat, in favor of two separate keys in the JSON object ( |
Beta Was this translation helpful? Give feedback.
-
Closing this, as all of the microsyntaxes have now been converted to structured data. |
Beta Was this translation helpful? Give feedback.
-
In its original (XML-based) draft, MNX defines a set of microsyntaxes/microformats that embed multiple pieces of information in a single attribute (represented as a string as all attributes in XML are).
As we move to JSON and have the opportunity for (1) typed data as attributes and (2) object hierarchies at each level of data, it makes sense to take a closer look at microformats and ask if one of the major MNX goals--making data more machine readable and able to be used as internal representations--can be better served by replacing microformats with explicit data types.
Time, Event, Note
I looked at three commonly used microformats. In order from least to most complex (with prior XML implementations)
<time signature="3/4" />
the Time Signature data type<event value="/2" />
the Note value data type<note pitch="C#4" />
the Chromatic Pitch data typePros of Microformats
In these three examples (3/4 time, half note, C-sharp in octave 4), the microformats have several important pros:
Cons of Microformats
But here are other implementations of the same types that I believe are currently valid.
<time signature="7 +6/*2dd + 9 + 2 + + + /16" />
-- a two-part composite time signature where the first element is 13 double-dotted breves (divided 7+6) and the second element is 12 (sic, not 11) sixteenths divided as 9 + 2 + 1.<event value="*4096dddddddddd">
a note equal to 4096 tied whole notes with ten dots.<note pitch="G####0000123+-" />
-- a G quadruple sharp in octave 123 with no microtonal alterations. or<note pitch="Abbbb2+239123/714o">
An A quadruple flat in octave two adjusted upward by about 335 octaves.Please take a minute to ask yourself -- are you sure your to-be-developed MNX parser can be added to your software without yielding a SIGFAULT? And even if you wanted to have a robust checker for your system before trying to create these objects, wouldn't you need an intermediate representation format where octaves and durations were an int or float first?
These are the extreme cases that show the negatives of microformats. Here are the more common cons:
Proposal
The W3C Music-Notation Working Group co-chairs met today and strongly endorsed the replacement of microformats/microsyntaxes with more explicit objects that de-entangle the various parts of the syntax. (We propose beginning with these three common microsyntax, but with a general principle that applies throughout the specification).
Implementation
No replacement implementation is proposed at this moment. However, presumably attributes like
"dots": 4
would replace the "dddd" part of the duration microsyntaxes, enumerations would replace some entries (such as note value). Precise implementations would be open to community discussion once discussion of the general principle concludes.Beta Was this translation helpful? Give feedback.
All reactions