Comments (6)
I think this makes sense and I agree. We just want to make sure this case applies to simple types only.
from musicxml.
I think this methodology could also be extended to types which are inherently attributed arrays of a union type (i.e., Kind
) (e.g., Notations
, Ornaments
, Dynamics
, Technical
, Encoding
, etc.).
Thus, we could have:
let notations = Notations([.ornaments(Ornaments([.mordent(Mordent())]))])
Instead of:
let notations = Notations(
values: [
.ornaments(
Ornaments(
values: [
.mordent(Mordent())
]
)
)
]
)
Furthermore, we could make these types conform to ArrayLiteralConvertible
if they are simple cases like so (without attributes).
let notations = Notations([.ornaments([.mordent(Mordent()))])
from musicxml.
And to really stretch the ergonomics, we may be able to get away with defining static properties on top of these union types:
extension Ornament {
static let mordent = Ornament.mordent(Mordent())
}
Thus making the previous example:
let notations = Notations([.ornaments([.mordent])])
Not entirely certain that the compiler will appreciate this, but it could be worth a try.
from musicxml.
And to really stretch the ergonomics, we may be able to get away with defining static properties on top of these union types:
extension Ornament { static let mordent = Ornament.mordent(Mordent()) }Thus making the previous example:
let notations = Notations([.ornaments([.mordent])])Not entirely certain that the compiler will appreciate this, but it could be worth a try.
We can already specify default values to the enums
, like
enum Ornament {
case mordent(Mordent = Mordent())
}
from musicxml.
Wait, whoa, what?! When did that happen? I'm gonna give that a shot.
from musicxml.
That's wild. The only slightly noisy aspect is that it has to be called as .mordent()
rather than .mordent
, but that is very interesting.
from musicxml.
Related Issues (20)
- Scrape MusicXML docs for code coverage HOT 3
- Support Partwise <-> Timewise conversion HOT 6
- Audit MusicXML -> Score -> Traversal structure HOT 1
- Audit placement of Header HOT 4
- Implement encoding for all types
- "Je fais un rêve" HOT 4
- Handle Empty* types better HOT 2
- Create a MusicXMLDecoder: XMLDecoder subclass HOT 2
- Decide top level element using regex match against <!DOCTYPE (score-partwise|score-timewise) HOT 6
- Problems importing with Xcode 11.1 Swift Package HOT 11
- Republish v0.2.0 with SHA reference to `jsbean/XMLCoder` HOT 1
- Trying to parse the MusicXml file error in the project HOT 21
- Support compressed musicXML format
- Release 0.2.3? HOT 1
- Support for Cocoapods and Carthage package managers HOT 3
- Contribution for rendering graphically? HOT 2
- I need help to include this package HOT 2
- Tests failing on clean checkout HOT 3
- Problem on getting the Score HOT 12
- Tests Fail!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from musicxml.