如果在开发代码中使用Smart :: Comments应该有什么问题? [英] What concerns should I have if I use Smart::Comments in development code?

查看:92
本文介绍了如果在开发代码中使用Smart :: Comments应该有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Smart :: Comments不应在生产代码中使用,因为它是源过滤器.

I understand that Smart::Comments should not be used in production code, since it is a source filter.

但是,我一直在开发代码中使用 Smart::Comments ,然后在将代码发送到生产环境之前注释掉使用"行.

However, I have been using Smart::Comments in my development code and then commenting out the "use" line before sending the code to production.

鉴于我将在开发代码中使用它,我应该特别注意什么?我已经搜索了Internet,但没有找到我应该担心的任何原因,除了源过滤器是一个坏主意"或邪恶",或者绝对不要在生产代码中使用它们.

Given that I'm going to use it in my development code, what I should specifically be concerned about? I've searched the Internet and not found any reasons that I should be worried except that source filters are "a bad idea" or "evil" or that they should never be used in production code.

更新: 我现在在 vim 中使用键绑定来实现SinanÜnür的方法:

UPDATE: I'm now using a key binding in vim to implement Sinan Ünür's approach:

map <Leader>c <Esc>:!perl -MSmart::Comments %<CR>

推荐答案

源过滤器有问题,因为它们使用了不完善的解析器来重写代码.只要过滤器管理您提供的代码,一切都可以正常工作.

Source filters are bad problematic because they use an imperfect parser to rewrite your code. Everything works great, as long as the filter manages the code you feed it.

添加添加内容会破坏过滤器的那一刻,整个系统就会自毁,并且会出现奇怪的错误.

The moment you add something that breaks the filter, the whole system self-destructs and you get bizarre bugs.

源过滤器还会使调试器混乱,如果使用调试器,这可能是个问题.

Source filters also confuse the debugger, which can be a problem--if you use the debugger.

这篇关于如果在开发代码中使用Smart :: Comments应该有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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