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

Should inline comments be included in the spec? #16

Open
abstrctn opened this issue May 6, 2015 · 5 comments
Open

Should inline comments be included in the spec? #16

abstrctn opened this issue May 6, 2015 · 5 comments
Labels

Comments

@abstrctn
Copy link
Contributor

abstrctn commented May 6, 2015

Several previous issues (#14 #15) have addressed cases where single-bracket inline comments are confusing, or not flexible enough. Looking through our own use of ArchieML at the New York Times, we discovered that we virtually never use them.

To avoid some of the confusion from #15, and to simplify parsing in general, there are two proposals:

  • Making inline comments disabled by default
  • Removing inline comments from the spec

Has anyone been using inline comments? If so, what do you think about these options?

@abstrctn
Copy link
Contributor Author

The latest draft of the spec has removed these, so I'll close this but feel free to leave any lingering thoughts you have here.

@gka
Copy link
Contributor

gka commented Jun 11, 2015

Yes, please keep some form of inline comments in the spec. I don't care how ugly the syntax is going to be. Let's go for JS style comments, they are pretty easy to type, widely known (among developers at least) and have a low chance of being typed accidentally.

My main use case is if you want to explain a key format.

anchor: 0,0  /* left,top (in pixel) */

@gka gka reopened this Jun 11, 2015
@gka
Copy link
Contributor

gka commented Jun 11, 2015

I really like how you can define the template tags in underscore templates by passing a regex. maybe we could do the same in archieml-js? so anyone could redefine their favorite inline comment style

archieml.options({
                  // regex for /* */ comments 
    commentRegex: /(?:\/\*(?:[\s\S]*?)\*\/)|(?:([\s;])+\/\/(?:.*)$)/gm
});

@abstrctn
Copy link
Contributor Author

I'm open to this as something opt-in.

My main concern at this point would be creating into a state where .aml files on their own aren't a complete representation of the data, since you need the parsing options as well to fully understand how a document should be interpreted.

We can definitely take a stab at this on a branch of archieml-js and see how it works in practice.

Happy to look at it eventually, but if anyone wants to take a stab at a pull request, this should be pretty self-contained.

@gka
Copy link
Contributor

gka commented Jun 25, 2015

Well, then let's simply use /* */ an be fine, right? But there's got to be some inline comments, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants