为什么 parenscript 函数全部改为小写?
使用 parenscript 时,如果我执行
(parenscript:ps (slot-value ($ "#mytextarea") 'selectionStart))
它会生成 javascript
$('#mytextarea').selectionstart;
请注意,selectionStart
现在是 selectionstart
。它丢失了 Start
上的大写 S! 如何保留大写的 S?
When using parenscript if I execute
(parenscript:ps (slot-value ($ "#mytextarea") 'selectionStart))
It produces the javascript
$('#mytextarea').selectionstart;
Note that selectionStart
is now selectionstart
. It lost the uppercase S on the Start
!
How do I keep that uppercase S around?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Parenscript 会自动从 lisp 命名约定(用破折号分隔单词)转换为 CamelCase,因此
:
Parenscript will automatically convert from the lisp naming convention (dashes separating words) to CamelCase, so:
results in
正如 Pillsy 所说,当 Lisp 编译器读取所有符号时,它们默认都是大写的。不过,有一种方法可以关闭它。请参阅 CLHS,23.1.2(Readtable 大小写对 Lisp 阅读器的影响), 以及访问器的描述
readtable-case
了解详细信息。例如,您可以通过将以下内容放入 Lisp 源文件中来启用“反转”模式(这可以说是唯一区分大小写的实用设置):
不幸的是,ParenScript 似乎并没有太多使用自定义readtable-case 设置,尽管它可以(并且在我看来应该)这样做。
As Pillsy remarked, all symbols are upper-cased by default when they are read by the Lisp compiler. There is a way of turning that off, though. See the CLHS, 23.1.2 (Effect of Readtable Case on the Lisp Reader), and the description of the accessor
readtable-case
for details. As an example, you can enable the “invert” mode (which is arguably the only practical setting that is also case-sensitive) by putting the following into your Lisp source file:Unfortunately, ParenScript does not seem to make much use of a custom readtable-case setting, even though it could (and, in my opinion, should) do so.