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

redesign: cannot use SyntaxOrTermWrapper's val()? #509

Closed
KiaraGrouwstra opened this issue Mar 26, 2016 · 5 comments
Closed

redesign: cannot use SyntaxOrTermWrapper's val()? #509

KiaraGrouwstra opened this issue Mar 26, 2016 · 5 comments

Comments

@KiaraGrouwstra
Copy link

I tried the following:

syntax test = function (ctx) {
  let expr = ctx.next().value;
  let v = expr.val();
  console.log('v', v);
  return #`${v}`;
}
test 1

Expected result: I can get the val() of something and use it within the macro.
Actual result: it returns Nothing.

disnet added a commit that referenced this issue Mar 26, 2016
Also, `.val` on the wrapper returns a nullable value instead of a maybe.
@disnet
Copy link
Member

disnet commented Mar 26, 2016

Should work now.

@disnet disnet closed this as completed Mar 26, 2016
@KiaraGrouwstra
Copy link
Author

With test ['foo', 'bar'] it appears .val() is now returning null.

@disnet
Copy link
Member

disnet commented Mar 27, 2016

That's intentional. I'm writing up the documentation on this but the key idea is that ['foo', 'bar'] is a single syntax object and so asking for its value doesn't make sense.

@KiaraGrouwstra
Copy link
Author

Hmm, I see... My expectation was that its value would be, well, the array ['foo', 'bar']. I'll definitely be reading as docs progress; looks like I'll definitely still have some learning to do.

@disnet
Copy link
Member

disnet commented Mar 27, 2016

You can get the syntax inside a delimiter with .inner.

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

No branches or pull requests

2 participants