Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Multiple GUIDs available to templates #41

Open
rmunn opened this issue May 13, 2016 · 0 comments
Open

Proposal: Multiple GUIDs available to templates #41

rmunn opened this issue May 13, 2016 · 0 comments

Comments

@rmunn
Copy link
Contributor

rmunn commented May 13, 2016

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.

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

No branches or pull requests

1 participant