4 ms·
You're correct, but I think the utility of knowing about compilers is underrated. There have been a few front page posts recently that demonstrate very naive ma
by noelwelsh 11y ago
You're correct, but I think the utility of knowing about compilers is underrated. There have been a few front page posts recently that demonstrate very naive machine models. E.g. a few days ago there was this post
> Writing Go took me a little longer since I had to implement
a lot of functionality provided for me in Ruby. However, for
every task it also made me think about what the computer
actually does.
http://jorin.me/textstat/ http://jorin.me/textstat/
Building a naive cost model for Ruby isn't so difficult if you know how compilers work. Believing that Go provides a model of what the computer actually does is rather naive. Both of these can be addressed by spending a bit of time studying compilers.
- Someone 11y ago"Building a naive cost model for Ruby isn't so difficult if you know how compilers work" You also need to know all of ruby. In particular, if you do not know how flexible the language is, you may make the mistake of thinking that function call targets can be resolved at compilation time. With duct typing, that gets considerably harder. Another example is that you may have to know the way integer overflow works. Wrap around, throw, or silently convert to bigint all have different performance characteristics (luckily that's an edge case for most programs) Also, if you aren't naive, it gets really hard to build a naive cost model for Ruby. You start thinking "will they have complicated things by doing X (e.g. assuming that x.f is a function, and recompiling if that assumption gets invalidated) to get performance here?" all the time.
- jdmichal 11y ago> With duct typing, that gets considerably harder. Your hypercorrection from duct tape is bleeding into your duck typing. So named because "if it looks like a duck, it must be a duck."
- js2 11y agoIt so happens that the tape was originally called duck tape, so named because it was made by applying adhesive to duck cloth. The name duct tape came later, when it started being used in construction to seal duct work. Amusingly, modern duct tape is not certified for that use. None of this has anything to do with the duck referred to in duck typing. But I am now curious about the etymology of "duck cloth" and whether it has any relation to water fowl that quack. edit: "strong, untwilled linen (later cotton) fabric," used for sails and sailors' clothing, 1630s, from Dutch doeck "linen cloth" (Middle Dutch doec), related to German Tuch "piece of cloth," Danish dug, Old Frisian dok, Old High German tuoh, all of unknown origin."
- JoeAltmaier 11y agoI thought it was ammo-case waterproof tape developed in WWII, affectionately called 'duck tape' by GI Joe.
- jdmichal 11y agoEtymology is fascinating some times. It appears that the use of "duck" as a type of fabric is still alive in English, though a lot of technical fabric terms aren't really well known in the general populous anymore. https://en.wikipedia.org/wiki/Cotton_duck https://en.wikipedia.org/wiki/Cotton_duck http://www.merriam-webster.com/dictionary/duck http://www.merriam-webster.com/dictionary/duck (4)