之前看到 网友推荐 You Don't Know JS Yet ?闲来无事,就是看了起来,第四章 有一个小节 标题是 ”With the Grain“,Google 翻译是”与谷物“,很难理解,搜索了半天, 最接近就是 https://forum.wordreference.com/threads/go-with-the-grain.3009091/ 一个回答,也不知道对不对
1
hyrepo 2022-08-04 11:04:29 +08:00 2
|
2
ht 2022-08-04 11:06:32 +08:00 1
grain 译作纹理,字面意思 with the grain 是顺着纹理。
引申一下,顺其自然,go with the grain 。 个人理解,不一定对。 |
3
lefthand2006 2022-08-04 11:07:05 +08:00 via iPhone 1
顺其自然?
|
4
laolaowang OP @hyrepo 新知识又增加了,感谢
|
5
darkengine 2022-08-04 11:10:45 +08:00
随大流
大体来说,代码风格需要随 JS 的大流,不要整得跟 Java, Python 似的 从细的方面看,需要随团队、已有项目的大流,不要因为看了“You Don't Know JS Yet”这本书就想着推翻已有的东西 |
6
66beta 2022-08-04 11:11:52 +08:00 1
@darkengine 懂了,别动屎山
|
7
darkengine 2022-08-04 11:14:16 +08:00
@66beta 不一定是屎山,已有团队或项目有自己的风格,有时候不一定跟在书上看的一样,如何实现没有对错之分。
|
8
laolaowang OP @66beta 哈哈!屎山到处有
|
9
ifdef 2022-08-04 11:16:55 +08:00 1
On the other hand, there's a grain you really should pay attention to and follow: the grain of how JS works, at the language level. There are things that work well and naturally in JS, given the right practice and approach, and there are things you really shouldn't try to do in the language.
Can you make your JS program look like a Java, C#, or Perl program? What about Python or Ruby, or even PHP? To varying degrees, sure you can. But should you? No, I don't think you should. I think you should learn and embrace the JS way, and make your JS programs as JS'y as is practical. Some will think that means sloppy and informal programming, but I don't mean that at all. I just mean that JS has a lot of patterns and idioms that are recognizably "JS," and going with that grain is the general path to best success. Finally, maybe the most important grain to recognize is how the existing program(s) you're working on, and developers you're working with, do stuff. Don't read these books and then try to change all that grain in your existing projects over night. That approach will always fail. ----------- 建议先读完,再思考,再提问。读英文文档不是做英译中。 |
10
laolaowang OP @ifdef 确实,我习惯是看不明白,就去翻译,等我看到最后才注意到后面其实说的很明白了,是个坏习惯
|
11
laoyur 2022-08-04 12:04:52 +08:00 1
▸ to go against the grain (to do sth)
figurative 违反常理(做某事) 摘自 Mac 自带词典,那么 with the grain 也自然能解释了 |
12
dandycheung 2022-08-04 14:12:24 +08:00 via Android
入乡随俗。
|
13
zanyzephyr 2022-08-04 17:10:36 +08:00
对 11 楼进行补充:
against the grain 是一个 phrase 。 看解释,2 楼说的对,这里 grain 应该取的是 “纹理” 的意思。 以下同摘自 Mac 自带词典: ``` PHRASES against the grain contrary to the natural inclination or feeling of someone or something: it goes against the grain to tell outright lies. [from the fact that wood is easier to cut along the line of the grain.] ``` |
14
bobo2 2022-08-04 18:29:41 +08:00
厉害,我都是找的译版
|
15
zjuster 2022-08-04 20:39:20 +08:00
To go with the grain (idiom) = to accept something rather than oppose it or fight against it.
其实你用谷歌搜这个词,如果没有结果的时候,额外加上 meaning 就可以搜到了。 这个词组刚好是因为被实体店 SEO 掉了,没出释义 |
16
zjuster 2022-08-04 20:41:35 +08:00 2
@laolaowang 高中考试做阅读理解,无论中英文,其实都要通读全文,再回头来看。
一两个单词不认识,通常不会影响到对全文理解。 我们考英语专业八级的时候,必然会遇到不认识的单词的,但不会影响做题(甚至有些题目,就是让你选这个特别生僻的词是什么意思)。 |