首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏自译文章/自学记录

    JavaScript Scoping and Hoisting

    这边文章将会尝试揭示为什么会这样,但是我们先要绕个路,来了解下JavaScript的作用域(scoping)。 JavaScript中的作用域(scoping) 对于JavaScript初学者来说最让人困惑的来源之一就是作用域(scoping)。 我发现,想要了解这些‘事情(scoping,hoisting)’是如何运作的 ,直接查阅ECMAScript Standard (pdf)往往是最有帮助的。 我希望这篇文章已经揭示了,对JavaScript程序员来说,最困惑的根源之一(scoping,hoisting)。我尽可能的透彻地阐述这件事,并避免在阐述这件事时 制造更多的困惑。 本文翻译自:http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html 转载请注明出处

    76520发布于 2019-08-26
  • 来自专栏机器学习与统计学

    R Programming week2 Functions and Scoping Rules

    Scoping Rules The scoping rules for R are the mainfeature that make it different from the original S scoping or static scoping. Acommon alternative is dynamic scoping. Related to the scoping rules is how R usesthe search list to bind a value to a symbol Lexical scoping This cansometimes give the appearance of dynamic scoping.

    56010发布于 2019-04-10
  • 来自专栏程序员维他命

    深入理解 Dart Function & Closure

    在正式介绍闭包之前,我们需要先来了解一下 Lexical scoping。 詞法作用域 Lexical scoping 也许你对这个词很陌生,但是它却是最熟悉的陌生人。我们先来看下面一段代码。 这很好理解,如果一个 Lexical scoping 中存在两个同名变量 a,那么我们访问的时候从语法上就无法区分到底你是想要访问哪一个 a 了。 简单的解释,var a = 0; 是该 dart 文件的 Lexical scoping 中定义的变量,而 var a = 1; 是在 main 函数的 Lexical scoping 中定义的变量,二者不是一个空间 也就是说,一个 Lexical scoping 内部 是能够访问到 外部 Lexical scoping 中定义的变量的。 在创建出来的这个 Function 的 Lexical scoping中定义了一个 num 变量,并赋值为 0。

    2K30发布于 2020-06-15
  • 来自专栏小鑫同学编程历险记

    【入门】你连Babel都不会配?那插件不成乱装了

    console.log(`hello ${value}`); }; 3.4 处理掉更多的语法: 3.4.1 转换块级变量定义: 安装并配置插件:@babel/plugin-transform-block-scoping ]; const plugins = [ "@babel/plugin-transform-arrow-functions", "@babel/plugin-transform-block-scoping ]; const plugins = [ "@babel/plugin-transform-arrow-functions", "@babel/plugin-transform-block-scoping = [ // "@babel/plugin-transform-arrow-functions", // ① 箭头函数 // "@babel/plugin-transform-block-scoping

    44120编辑于 2022-12-26
  • 来自专栏漫画前端

    告别预编译,CSS 直接写嵌套的日子就要来临~

    CSS 工作组都干了什么 其实,早在2014年4月3日,W3C 就发布过一个 CSS范围(scoping)模块 的工作草案;2015年9月23日,谷歌的工程师 Tab Atkins 也发布过一个 CSS ;若是和scope相关的,则标题格式是“[css-scoping]...”。诚邀大家提出建设性的意见/建议。 相关规范: CSS Nesting Module Level 3 CSS Scoping Module Level 1 CSS Cascading and Inheritance Level 3 本文章仅代表个人观点

    1.5K40发布于 2020-12-16
  • 来自专栏猿人谷

    怎样写解释器

    这种把外层参数的值记录在内层函数的闭包里的做法,叫做“lexical scoping”或者“static scoping”。 在调用的时候“动态”解析变量的做法,叫做“dynamic scoping”。事实证明 dynamic scoping 的做法是严重错误的,它导致了早期语言里面出现的各种很难发现的bug。 早期的 Lisp,现在的 Emacs Lisp 和 TeX 就是使用 dynamic scoping 的语言。 为了演示 lexical scoping 和 dynamic scoping 的区别。 但是如果我们的解释器是 dynamic scoping,那么最后的结果就会等于 8。 这是因为最外层的 y 开头被绑定到了 4,而 dynamic scoping 没有记住内层的 y 的值,所以使用了外层那个 y 的值。 为什么 Lexical scoping 更好呢?

    2K70发布于 2018-01-17
  • 来自专栏大白技术控的技术自留地

    C++、Java语法差异对照表

    file): class Foo { static private int x; // static initialization block { x = 5; } } Scoping MyClass { public: static doStuff(); }; // now it's used like this MyClass::doStuff(); Java All scoping

    1.9K40发布于 2019-03-05
  • 来自专栏C++核心准则原文翻译

    C++核心准则ES.74:尽量在循环变量初始化表达式中定义循环变量​

    Discussion: Scoping the loop variable to the loop body also helps code optimizers greatly.

    1.5K10发布于 2020-06-03
  • 来自专栏全栈程序员必看

    Spidermonkey_spider是什么意思

    __parent__: js的scope为lexical(static) scoping. __parent__指向了lexical scoping的parent。 dynamic scoping: 变​量​随​着​控​制​流​的​进​入​而​绑​定​在​s​t​a​c​k​上​,​随​着​控​制​流​的​结​束​而​从​s​t​a​c​k​上​弹​出​。​ (C++ statement block) 无法在编译时期确定非局部变量(free variables)的作用域,故称之为dynamic scoping。 Slide 18 lexical(static) scoping: 变​量​始​终​指​向​同​一​个​执​行​上​下​文​。​

    1.2K20编辑于 2022-11-03
  • 来自专栏walterlv - 吕毅的博客

    在 WPF 中使用 x:Reference

    Exceptions to this general guidance might include cases where there are data context or other scoping

    1.9K20发布于 2020-02-10
  • 来自专栏李维亮的博客

    console.log()如何缩写为log()

    Javascript语言采用的是静态作用域规则(lexical scoping): function foo() { console.log( a ); // 2 } function bar

    1.4K30发布于 2021-07-09
  • 来自专栏旅途散记

    社区"偶遇"RSC

    看了一下他的改动, scrape: fix two loop variable scoping bugs in test Consider code like: for i := 0; i < numTargets

    38420编辑于 2023-06-18
  • 来自专栏葡萄城控件技术团队

    CoffeeScript和Sass提高Web开发效率

    Lexical Scoping and Variable Safety 2.  If, Else, Unless, and Conditional Assignment 3. 

    99770发布于 2018-01-10
  • 来自专栏肘子的Swift记事本

    苹果为傲慢付出了代价 | 肘子的 Swift 周报 #082

    值得一提的是,Swift 6.1 引入的 Test Scoping Traits[16]也是基于 @TaskLocal实现的,它们在测试场景中可以很好地配合使用,构建出清晰可控的异步上下文环境。 Values in Swift): https://l.fatbobman.com/w082-04 [15] Majid Jabrayilov: https://x.com/mecid [16] Test Scoping Traits: https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0007-test-scoping-traits.md

    50010编辑于 2025-05-06
  • 来自专栏企业平台构建

    javascript---变量

    var a;//加上这个后没有报错,但是弹出来的是undefined var a = 1;//同上,只是声明了a } 感觉js的方法中的参数,在使用后可以声明,但是不能定义(赋值); 解析:Scoping

    67930发布于 2019-08-07
  • 来自专栏全栈开发之路

    (自制翻译)如何解决在vue中this报错undefined

    箭头函数的作用域被称为词法作用域(或静态作用域lexical scoping)。我们将深究其中的原理,但首先我们要明白在箭头函数中,this是去函数定义时的环境中查询的。 这样就允许我们通过this去引用vue组件并更新dataFromServer 使用Lodash库或Underscore库 (没用过这两个库,不翻译了) 什么是lexical scoping(静态作用域)

    4.4K40发布于 2019-08-20
  • 来自专栏大话swift

    kotlin标准库扩展之 let run apply also(一)

    不停的使用if判断显然是不合乎设计的,于是我么的let应运而生 The Kotlin standard library function let can be used for scoping and

    53010发布于 2019-09-17
  • 来自专栏肘子的Swift记事本

    切勿将辅助驾驶宣传成智能驾驶 | 肘子的 Swift 周报 #078

    在测试方面,Swift Testing 推出了 Test Scoping Traits[7],使测试前后的上下文共享更加灵活易控;Swift-DocC 也改进了重载函数链接的歧义处理机制,提升文档的可维护性与可读性 Swift 6.1 发布: https://l.fatbobman.com/w078-01 [6] Holly Borla: https://x.com/hollyborla [7] Test Scoping Traits: https://www.pointfree.co/blog/posts/169-new-in-swift-6-1-test-scoping-traits?

    45700编辑于 2025-04-09
  • 来自专栏子舒的个人博客

    揭秘箭头函数

    作用域 const arrowFunctionScope = () => { console.log('Hi, my scoping rules works similar to function

    1.6K20编辑于 2022-06-09
  • 来自专栏Python程序员杂谈

    Python音频播客推荐:捕蛇者说

    Parse 实现 RFC 7230 Section 5.4 Host Fix memory leak in Rule function builder Short description of the scoping

    1.4K20发布于 2019-05-22
领券