我如何可以模拟在JavaScript中宏? [英] How can I simulate macros in JavaScript?

查看:96
本文介绍了我如何可以模拟在JavaScript中宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,JavaScript不支持宏(Lisp的风格的),但我想知道如果任何人有一个解决方案,也许模拟宏?我用Google搜索它,解决办法之一使用eval()的建议,但他说,将是相当昂贵的。

I know that JavaScript doesn't support macros (Lisp-style ones) but I was wondering if anyone had a solution to maybe simulate macros? I Googled it, and one of the solutions suggested using eval(), but as he said, would be quite costly.

他们真的没有很花哨。我只想做简单的东西与他们。而且这不应该使调试显著困难:)

They don't really have to be very fancy. I just want to do simple stuff with them. And it shouldn't make debugging significantly harder :)

推荐答案

您可以使用 parenscript 。这会给你的宏为Javascript。

You could use parenscript. That'll give you macros for Javascript.

这篇关于我如何可以模拟在JavaScript中宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆