由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 老高有话说
进入Programming版参与讨论
1 (共1页)
h**********c
发帖数: 4120
1
老高有话说
HN检索了这篇文章
来分享一下,本版还没有议
https://evrone.com/james-gosling-interview
computations on code fragments to generate new code
这没太看懂,能举隔例子,有什么优点?
用了很多的LISP,是另外一个世界,我不记得本版十几年讨论过LISP
另外问题是比较粗浅,JAVA annotation 区别与C 的宏?太粗浅,为了问而问。
I lolve this part. You know a lot people doing LOL things then oops.
就是说为了downstream 过的舒服点,有些bug甚至也不修,写一个新的实现让用户来选
择。
"One other area where there is always a fair amount of discomfort is: when
there's a bug in something, and people do workarounds for the bug, if you
fix the bug, you may break the workarounds. There have certainly been
instances in the Java world where we decided either not to fix bugs or
introduced a method that does the correct thing. That even shows up in
hardware. There's an issue with sin and cos, they were slightly incorrect,
so you have to have correct and incorrect instructions."
这两天写一个东西,比如,一个function 里有一个JSON,那么this指向谁?绕的有磕
药了的感觉。下面给了解释。
weak type就是猜,动态DEBUG花大把时间在intellij里evaluate
"So, I'm a big fan of just about anything that IDE can do to reduce the
probability of a bug. So when we look at the dynamically-typed languages
like JavaScript and Python, they have less of an inference framework to work
that out because they don't necessarily know what the type of anything is;
they’re just kind of guessing. Strongly-typed languages, like Java, provide
a much more rigorous framework for the type checkers to use."
另外一个问题namespace 的restrictor like private, proteced, public对程序现实
的安全的例子?或者其它益处?
Highlight this "And the difference between working once and working every
time is huge."
py没有真正的整数,you need numerical analysis 来理解这段,跳过暂时
“Performance is kind of a boolean: it's fast enough, or it's not fast
enough.”
My five cents, 100 microservices, any change 100 PRs and merges.
“When people talk about microservices, they're a fine thing, but just
understand that they're at least a factor of a million slower than a method
call. ”
好像说coroutine还是单线程LOL
"And for me, one of the problems with coroutines, which is why I haven't
used them in a long time, is that they don't actually let you do or let you
take advantage of multiple processors."
ABOUT sync or async
sync or not? my five cents: you have to guess in a weak type language, I
mean you don't know anyting about a function call will behave.
就是说你有一台机器,我自己的这一段,你要猜来知道它能干吗?好像有病,我买这新
玩意来给你写手册。
Again, golden word.
"And the difference between working once and working every time is huge."
觉得老高还是尽量干自己的活,也给别人留口饭吃。
老高的世界似乎不太和书的世界重合,互联网web 开发.加上英语口语习惯。
一个字窜,encoded/Jacksoned 前端千变万化的浏览器版本,at the mercy of a
dynamic alien script or scripts, 加密信道,证书验证,路由,DNS,防火墙,ID/
IP intrusion stuff, cluster/load balancing, API verisoning, message queue,
后端业务逻辑,message queue,第三方专有敏感信息etc, legacy 系统访问/或legacy
方式的接口,persist 到数据库, performance monitoring, centralized logging,
版本控制
忽略企业政治文化 etc etc
"And the difference between working once and working every time is huge."
d*******r
发帖数: 3299
2
"我不记得本版十几年讨论过LISP"
本版经常有Lisp讨论, 还有给Clojure布道的大牛(hci)
h*i
发帖数: 3446
3
His thinking is very conventional.
Nothing interesting in this piece to be honest.

【在 h**********c 的大作中提到】
: 老高有话说
: HN检索了这篇文章
: 来分享一下,本版还没有议
: https://evrone.com/james-gosling-interview
: computations on code fragments to generate new code
: 这没太看懂,能举隔例子,有什么优点?
: 用了很多的LISP,是另外一个世界,我不记得本版十几年讨论过LISP
: 另外问题是比较粗浅,JAVA annotation 区别与C 的宏?太粗浅,为了问而问。
: I lolve this part. You know a lot people doing LOL things then oops.
: 就是说为了downstream 过的舒服点,有些bug甚至也不修,写一个新的实现让用户来选

b***e
发帖数: 1419
4
Runtime code generation 一个通常的例子就是生成平方函数。考虑幂函数:
pow x n = if (n==0) then 1 else x * pow x (n-1)
我现在有一个应用,要使用平方函数10^9次。我考虑这样做:
square x = pow x 2
然后就可以重复使用这个square函数10^9次。但是这有个问题:使用如此定义的square
每次都要做if判断和递归调用。如果我替换这个定义为:
square x = x * x
这个效率就高很多。 但是问题又来了,如果我需要重复使用的不是平方函数,而是一
个计算1000次方的函数呢?或者,我既要平方函数,又要立方函数,又要四次方函数…
所以我们寻求的是同时满足通用性和特殊化。这似乎是矛盾的。但是lisp给了一个解
决方法。
我们可以定义一个pow生成函数如下:
_powgen n x = if (n == 0) then <1> else <^x * ^(_powgen (n-1) x)>
powgen n = <\x -> ^(_powgen n )>
于是我们可以定义:
square = eval (powgen 2)
这个square函数在runtime会被计算成
\x -> x * x * 1
如此,我们同时实现了定义上的通用性和使用上的特殊化。
备注:我这里使用的是Haskell Syntax, 不是Lisp Syntax,因为Lisp Syntax看着晕
的很。Lisp用的是back quote/comma notation,对应我这里用的bracket/caret
notation。
h**********c
发帖数: 4120
5
thanks, 还没仔细品明白了

square

【在 b***e 的大作中提到】
: Runtime code generation 一个通常的例子就是生成平方函数。考虑幂函数:
: pow x n = if (n==0) then 1 else x * pow x (n-1)
: 我现在有一个应用,要使用平方函数10^9次。我考虑这样做:
: square x = pow x 2
: 然后就可以重复使用这个square函数10^9次。但是这有个问题:使用如此定义的square
: 每次都要做if判断和递归调用。如果我替换这个定义为:
: square x = x * x
: 这个效率就高很多。 但是问题又来了,如果我需要重复使用的不是平方函数,而是一
: 个计算1000次方的函数呢?或者,我既要平方函数,又要立方函数,又要四次方函数…
: 所以我们寻求的是同时满足通用性和特殊化。这似乎是矛盾的。但是lisp给了一个解

1 (共1页)
进入Programming版参与讨论