zzarchive-generator-fsharp
zzarchive-generator-fsharp copied to clipboard
Proposal: Multiple GUIDs available to templates
I have been playing around with the cross-platform GUI library Eto recently, seeing if it's suitable for building cross-platform apps in F#. Eto has a nice Visual Studio addon that includes some well-designed templates for new projects: they create a "main" project where all the cross-platform code lives, and one "subproject" per platform (one for Gtk, one for WinForms, one for Xamarin.Mac, and so on). Each of these subprojects has its own GUID.
I wanted to copy Eto's templates into generator-fsharp, so that I could easily create new Eto projects with Ionide and Atom. But I discovered that generator-fsharp only provides a single GUID to file templates:
this.templatedata.guid = uuid.v4();
What I'd like to do to make my use-case possible is something like:
this.templatedata.guid = uuid.v4(); // Most templates will still use this
this.templatedata.guids = [];
for (i=0; i<10; i++) { // If ten isn't enough, then i<100 instead
this.templatedata.guids.push(uuid.v4());
}
Any existing templates could continue to use guid
, but any templates that need more than one GUID (and need to reference those GUIDs consistently in multiple places) could use guids[0]
through guids[9]
. (Or even through guids[99]
if it turns out that ten is too limiting).
Generating eleven (or a hundred and one) random GUIDs instead of just one shouldn't take up too much extra time, I would think. (Though I haven't benchmarked it yet). The question is, does this seem worth it? Are there any other templates that would benefit from having multiple GUIDs available, or is my use-case such a rare scenario that it's not worth adding extra complexity for it?
I'll probably go ahead and write a PR for this change in a few days, but before I do, I wanted to hear other people's opinions on whether this would be useful to them.