sweet-js/sweet-core

Can you make a "symbol" macro?

jasuperior opened this issue · 5 comments

I realize that you can make an operator which uses non-alphanumeric characters. But is it possible to also create a macro which uses non-alpha as well? i.e.:

syntax -> = function (ctx) {
  let context = ctx.next().value;
  let type = ctx.next().value;
  let fn = ctx.next().value;
  return #`new Event(${context}, ${type}, ${fn})`;
}

-> first second third //compiles to new Event(first,second,third);

are you guys still maintaining this repo? Because no one has responded in 3 days.

3 days isn't a lot of time...

@jasuperior -> isn't a valid identifier and so can't be used to define a macro.

@vendethiel it’s long enough to think no one is going to respond. Especially considering the fact that my question of whether it was still being maintained or not got answered in moments.

@gabejohnson I appreciate the direct and succinct response.

Just to clarify a couple of things, @gabejohnson is right that -> isn't an identifier but there's no inherent reason why non-identifiers can't be used to define a macro and at some point I would like to extend the kinds of tokens macros can use as names.

In addition, -> is actually two tokens (- and >) and so even if we allowed punctuators for macro names your example still wouldn't work. At the moment I think the answer to this will be to use readtables once we expose them to user-code but that's up for discussion.

With regard to the three day non-response, please remember that most open source projects are run by folks who do so in their spare time. The expectation that maintainers must respond immediately leads directly to burn out. Please keep that in mind in your future conversations with open source maintainers so we can build heathy ecosystems. Thanks!