Open zwhu opened 8 years ago
昨天被问到「你学编译原理有什么用,对你现在的工作有什么帮助吗?」
我当时脑袋不太好,没有很好地回答出来,只说了一些关于 JavaScript 的变量提升方面的东西。直到今天下午我读 w3c 的 rfc2612 规范的时候,我才意识到学习编译原理对我的帮助和影响。
在 rfc2612 规范中定义了一系列的 Catch-Control 的指令如下:
Cache-Control = "Cache-Control" ":" 1#cache-directive cache-directive = cache-request-directive | cache-response-directive cache-request-directive = "no-cache" ; Section 14.9.1 | "no-store" ; Section 14.9.2 | "max-age" "=" delta-seconds ; Section 14.9.3, 14.9.4 | "max-stale" [ "=" delta-seconds ] ; Section 14.9.3 | "min-fresh" "=" delta-seconds ; Section 14.9.3 | "no-transform" ; Section 14.9.5 | "only-if-cached" ; Section 14.9.4 | cache-extension ; Section 14.9.6 cache-response-directive = "public" ; Section 14.9.1 | "private" [ "=" <"> 1#field-name <"> ] ; Section 14.9.1 | "no-cache" [ "=" <"> 1#field-name <"> ]; Section 14.9.1 | "no-store" ; Section 14.9.2 | "no-transform" ; Section 14.9.5 | "must-revalidate" ; Section 14.9.4 | "proxy-revalidate" ; Section 14.9.4 | "max-age" "=" delta-seconds ; Section 14.9.3 | "s-maxage" "=" delta-seconds ; Section 14.9.3 | cache-extension ; Section 14.9.6 cache-extension = token [ "=" ( token | quoted-string ) ]
看到上面一段内容,我脑海里自然地就知道这是 cache-control 的 DSL,定义了 cache-control 的写法。
DSL
讲道理,学「编译原理」或者「算法」这种基础学科,也许对目前的工作确实没有什么明显的帮助,但是它终究会在你无意识的情形下,润物细无声的影响你。
原理和基础这些都是下层建筑,这些知识的作用往往都是做支撑,是沉淀。
@limichange 对
昨天被问到「你学编译原理有什么用,对你现在的工作有什么帮助吗?」
我当时脑袋不太好,没有很好地回答出来,只说了一些关于 JavaScript 的变量提升方面的东西。直到今天下午我读 w3c 的 rfc2612 规范的时候,我才意识到学习编译原理对我的帮助和影响。
在 rfc2612 规范中定义了一系列的 Catch-Control 的指令如下:
看到上面一段内容,我脑海里自然地就知道这是 cache-control 的
DSL
,定义了 cache-control 的写法。讲道理,学「编译原理」或者「算法」这种基础学科,也许对目前的工作确实没有什么明显的帮助,但是它终究会在你无意识的情形下,润物细无声的影响你。