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

Make mapIt work on openArray's #8543

Merged
merged 4 commits into from
Aug 7, 2018
Merged

Make mapIt work on openArray's #8543

merged 4 commits into from
Aug 7, 2018

Conversation

LemonBoy
Copy link
Contributor

@LemonBoy LemonBoy commented Aug 5, 2018

No description provided.

@Araq
Copy link
Member

Araq commented Aug 5, 2018

Maybe it's better to introduce a more general evaluateOnce idea that only produces a let if it's not a parameter already. This would also improve efficiency since we don't rely on copies being optimized away so much.

@LemonBoy
Copy link
Contributor Author

LemonBoy commented Aug 6, 2018

Like this?

EDIT cool, symKind is not available during the bootstrap (?)

@@ -635,6 +635,20 @@ template mapIt*(s, typ, op: untyped): untyped =
result.add(op)
result

macro evalOnce(exp: untyped, varName: static[string]): untyped =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is varName a string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because genSym likes strings? I can probably use a untyped argument and then stringify it if you don't like the string thing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, please do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, the bootrstrapping is still hosed due to the missing symKind.

@Araq
Copy link
Member

Araq commented Aug 6, 2018

So use when declared(macros.symKind)...

@LemonBoy
Copy link
Contributor Author

LemonBoy commented Aug 7, 2018

Fine, this is now ready.

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

Successfully merging this pull request may close these issues.

2 participants