V2EX 首页   注册   登录
 dtysky 最近的时间轴更新


  •   Bilibili / 前端工程师
  •   V2EX 第 113030 号会员,加入于 2015-04-23 22:00:17 +08:00,今日活跃度排名 5913
    编译 TypeScript、C++和 Rust 到 WebAssembly
    JavaScript  •  dtysky  •  20 天前  •  最后回复来自 dtysky
    Bilibili《七夕之约 - Double;7》技术剖析
  •  2   
    程序员  •  dtysky  •  145 天前  •  最后回复来自 LaserUFO
  •  2   
    程序员  •  dtysky  •  167 天前  •  最后回复来自 Plsea
    BlogReworkPro - 一个 SEO 友好的 SPA,相关 React 全家桶, FLASK,服务端渲染
  •  1   
    程序员  •  dtysky  •  2016-10-14 21:06:23 PM  •  最后回复来自 chux0519
    程序员  •  dtysky  •  2016-09-06 13:03:54 PM  •  最后回复来自 pysama
    MoeNotes v0.9 发布:更新 Lolita 主题并添加 PDF/HTML 导出功能
    程序员  •  dtysky  •  2016-07-08 11:30:27 AM  •  最后回复来自 sumuu
  •  1   
    职场话题  •  dtysky  •  2016-07-05 11:51:52 AM  •  最后回复来自 zhonghua
    撸了个笔记 APP
    程序员  •  dtysky  •  2016-05-20 15:31:13 PM  •  最后回复来自 popfeng
    程序员  •  dtysky  •  2016-05-15 17:12:57 PM  •  最后回复来自 zmr90
    dtysky 最近回复了
    7 天前
    回复了 mb135 创建的主题 程序员 猿们,还记得前几年火热的 nosql 吗?


    Error Correction

    One of the most hotly contested religious wars in the JS community (besides tabs vs. spaces) is whether to rely heavily/exclusively on ASI or not.

    Most, but not all, semicolons are optional, but the two ;s in the for ( .. ) .. loop header are required.

    On the pro side of this debate, many developers believe that ASI is a useful mechanism that allows them to write more terse (and more "beautiful") code by omitting all but the strictly required ;s (which are very few). It is often asserted that ASI makes many ;s optional, so a correctly written program without them is no different than a correctly written program with them.

    On the con side of the debate, many other developers will assert that there are too many places that can be accidental gotchas, especially for newer, less experienced developers, where unintended ;s being magically inserted change the meaning. Similarly, some developers will argue that if they omit a semicolon, it's a flat-out mistake, and they want their tools (linters, etc.) to catch it before the JS engine corrects the mistake under the covers.

    Let me just share my perspective. A strict reading of the spec implies that ASI is an "error correction" routine. What kind of error, you may ask? Specifically, a parser error. In other words, in an attempt to have the parser fail less, ASI lets it be more tolerant.

    But tolerant of what? In my view, the only way a parser error occurs is if it's given an incorrect/errored program to parse. So, while ASI is strictly correcting parser errors, the only way it can get such errors is if there were first program authoring errors -- omitting semicolons where the grammar rules require them.

    So, to put it more bluntly, when I hear someone claim that they want to omit "optional semicolons," my brain translates that claim to "I want to write the most parser-broken program I can that will still work."

    I find that to be a ludicrous position to take and the arguments of saving keystrokes and having more "beautiful code" to be weak at best.

    Furthermore, I don't agree that this is the same thing as the spaces vs tabs debate -- that it's purely cosmetic -- but rather I believe it's a fundamental question of writing code that adheres to grammar requirements vs. code that relies on grammar exceptions to just barely skate through.

    Another way of looking at it is that relying on ASI is essentially considering newlines to be significant "whitespace." Other languages like Python have true significant whitespace. But is it really appropriate to think of JavaScript as having significant newlines as it stands today?

    My take: use semicolons wherever you know they are "required," and limit your assumptions about ASI to a minimum.
    在下穿衣风格属于突变型的,夏天 COSPA 彩色宅 T,冬天全身休闲正装+衬衫,妹子也没说什么(逃
    @xwhxbg 这两个都是可以逆向的,只是相对安全点罢了
    @bombless 那你试试 rust 的 yew 吧 2333
    20 天前
    回复了 dtysky 创建的主题 JavaScript 编译 TypeScript、C++和 Rust 到 WebAssembly
    嗯,昨儿有人提了个 issue,我早上加到说明里了

    Now, rustc supports another method to generate pure wasm file, please see here for resolution: [Rust for the Web]( https://www.hellorust.com/setup/wasm-target/):

    rustc --target wasm32-unknown-unknown yourCode.rs -o yourCode.wasm

    For reducing the size of file, your need to install **wasm-gc**:

    cargo install --git https://github.com/alexcrichton/wasm-gc
    wasm-gc yourCode.wasm small-yourCode.wasm
    2017: open shit
    2018: opeb source
    webcv 有可能不?
    28 天前
    回复了 IC0ZB 创建的主题 程序员 程序员的一生要经历多少苦难?救救我吧
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   鸣谢   ·   2017 人在线   最高记录 3541   ·  
    World is powered by solitude
    VERSION: · 34ms · UTC 14:03 · PVG 22:03 · LAX 06:03 · JFK 09:03
    ♥ Do have faith in what you're doing.