首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏函数式编程语言及工具

    Scala Macros - 元编程 Metaprogramming with Def Macros

    Scala Macros可以直接对程序进行修改。 , demos) 18 19 lazy val macros = project.in(file("macros")).settings(commonSettings : _*) 20 21 lazy dependsOn(macros),因为我们会把所有macros定义文件放在macros目录下。 代码放在macros目录下的MacrosLibrary.scala里。首先必须import macros和Context。 Scala Def Macros还提供了Extractor Macros,结合Scala String Interpolation和模式匹配来提供compile time的extractor object

    3.4K90发布于 2018-01-05
  • 来自专栏菠萝上市没有

    Rust 过程宏(Procedural Macros)基础

    官方解释: You can sort of think of procedural macros as functions from an AST(抽象语法树) to another AST. — The

    3.4K00发布于 2021-06-09
  • 来自专栏ShanSan的云原生之路

    (译) Understanding Elixir Macros, Part 1 Basics

    Elixir Macros 系列文章译文 [1] (译) Understanding Elixir Macros, Part 1 Basics [2] (译) Understanding Elixir Macros, Part 2 - Micro Theory [3] (译) Understanding Elixir Macros, Part 3 - Getting into the AST [4] (译) Understanding Elixir Macros, Part 4 - Diving Deeper [5] (译) Understanding Elixir Macros, Part 5 这是讨论宏 (Macros) 微系列文章的第一篇. 原文:https://www.theerlangelist.com/article/macros_1

    65930编辑于 2023-10-21
  • 来自专栏ShanSan的云原生之路

    (译) Understanding Elixir Macros, Part 3 - Getting into the AST

    Elixir Macros 系列文章译文 [1] (译) Understanding Elixir Macros, Part 1 Basics [2] (译) Understanding Elixir Macros, Part 2 - Micro Theory [3] (译) Understanding Elixir Macros, Part 3 - Getting into the AST [4] (译) Understanding Elixir Macros, Part 4 - Diving Deeper [5] (译) Understanding Elixir Macros, Part 5 - Reshaping the AST [6] (译) Understanding Elixir Macros, Part 6 - In-place Code Generation 原文 GitHub 原文: https://www.theerlangelist.com/article/macros_3

    59950编辑于 2023-10-21
  • 来自专栏ShanSan的云原生之路

    (译) Understanding Elixir Macros, Part 4 - Diving Deeper

    Elixir Macros 系列文章译文 [1] (译) Understanding Elixir Macros, Part 1 Basics [2] (译) Understanding Elixir Macros, Part 2 - Micro Theory [3] (译) Understanding Elixir Macros, Part 3 - Getting into the AST [4] (译) Understanding Elixir Macros, Part 4 - Diving Deeper [5] (译) Understanding Elixir Macros, Part 5 - Reshaping the AST [6] (译) Understanding Elixir Macros, Part 6 - In-place Code Generation 原文 GitHub 原文: https://www.theerlangelist.com/article/macros_4

    39230编辑于 2023-10-21
  • 来自专栏ShanSan的云原生之路

    (译) Understanding Elixir Macros, Part 2 - Micro Theory

    Elixir Macros 系列文章译文 [1] (译) Understanding Elixir Macros, Part 1 Basics [2] (译) Understanding Elixir Macros, Part 2 - Micro Theory [3] (译) Understanding Elixir Macros, Part 3 - Getting into the AST [4] (译) Understanding Elixir Macros, Part 4 - Diving Deeper [5] (译) Understanding Elixir Macros, Part 5 - Reshaping the AST [6] (译) Understanding Elixir Macros, Part 6 - In-place Code Generation 原文 GitHub 原文: https://www.theerlangelist.com/article/macros_2

    55040编辑于 2023-10-21
  • 来自专栏ShanSan的云原生之路

    (译) Understanding Elixir Macros, Part 5 - Reshaping the AST

    Elixir Macros 系列文章译文 [1] (译) Understanding Elixir Macros, Part 1 Basics [2] (译) Understanding Elixir Macros, Part 2 - Micro Theory [3] (译) Understanding Elixir Macros, Part 3 - Getting into the AST [4] (译) Understanding Elixir Macros, Part 4 - Diving Deeper [5] (译) Understanding Elixir Macros, Part 5 - Reshaping the AST [6] (译) Understanding Elixir Macros, Part 6 - In-place Code Generation 原文 GitHub 原文: https://www.theerlangelist.com/article/macros_5

    36330编辑于 2023-10-21
  • 来自专栏函数式编程语言及工具

    Scala Macros - scalamela 1.x,inline-meta annotations

    Scalameta是根据scala语言规范SIP-28-29-Inline-Macros由零重新设计的Macros编程工具库。 这事动摇了我继续探讨的意愿:试想如果没了”Implicit Macros“,“Extractor Macros“这些模式,会损失多少理想有趣的编码方式。 我们可以把上次Def MacrosMacros Annotations示范例子在Scalameta里重新示范一遍来达到这样的目的。   与Def Macros运算原理相同,Scalameta的Macros扩展也是基于AST(abstract syntax tree)由编译器运算产生的,因此Macros申明必须先完成编译,所以我们还是沿用了上一篇讨论中的 直观上Macros编程简单了,实际上编写的Macros程序能更安全稳定的运行。

    1.4K90发布于 2018-01-05
  • 来自专栏Rust语言学习交流

    【Rust日报】2019-09-15 - The little book of rust macros

    本书试图提炼Rust社区对Rust宏的知识集,目前还在完善中,欢迎添加PR和issue。

    61020发布于 2019-09-17
  • 来自专栏ShanSan的云原生之路

    (译) Understanding Elixir Macros, Part 6 - In-place Code Generation

    Elixir Macros 系列文章译文 [1] (译) Understanding Elixir Macros, Part 1 Basics [2] (译) Understanding Elixir Macros, Part 2 - Micro Theory [3] (译) Understanding Elixir Macros, Part 3 - Getting into the AST [4] (译) Understanding Elixir Macros, Part 4 - Diving Deeper [5] (译) Understanding Elixir Macros, Part 5 - Reshaping the AST [6] (译) Understanding Elixir Macros, Part 6 - In-place Code Generation 原文 GitHub 原文: https://www.theerlangelist.com/article/macros_6

    52040编辑于 2023-10-21
  • 来自专栏全栈前端精选

    深入浅出 Babel 下篇:既生 Plugin 何生 Macros

    既然 Babel 有了 Plugin 为什么又冒出了个 babel-plugin-macros? 所以才催生除了 babel-plugin-macros, 大家可以看这个 Issue: RFC - babel-macros 所以为 Babel 寻求一个零配置的机制是 babel-plugin-macros (查看awesome-babel-macros) 如何写一个 Babel Macro 所以,Babel Macro是如何运作的呢? 本文对‘宏’进行了深入的讨论,从 C 语言的文本替换宏到濒死的Sweet.js, 最后介绍了babel-plugin-macros. ,Babel Macro 可以做很多有意思的东西,查看《Awesome babel macros》。不过要谨记:显式好于隐式,清晰的代码优于简洁的代码

    1.8K31发布于 2019-10-18
  • 来自专栏Rust语言学习交流

    【Rust日报】2022-08-04 Rust 需要 proc-macros 2.0 吗?

    Rust 需要 proc-macros 2.0 吗? 毫无疑问,宏是 Rust 编程语言的一个重要特性。像 println!, lazy_static! rust 改进了声明性宏,但 Rust 也有 proc-macros(过程宏)。Proc-macros 本质上是将标记流转换为标记流的编译器的扩展。 这使得 proc-macros 在声明性宏无法处理的情况下非常强大和有用。文章为我们讲解了 proc-macros 的优劣,同时也给出了很棒的 proc-macros 代码。

    56140编辑于 2022-11-28
  • 来自专栏along的开发之旅

    Android ndk编译FFMPEGIJKPlayer报错 `ndk missing -D__STDC_CONSTANT_MACROS` 解决办法

    但是运行时提示: ndk missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS 查找了一番, 没有找到直接的答案. 通过提示知道需要给cpp增加一个标识, 按照如下这样在gradle的 cppFlags 增加 "-D__STDC_CONSTANT_MACROS"即可. -> 'src/main/libs' cppFlags "-DTEST_CPP_FLAG2", "-DTEST_CPP_FLAG2", "-D__STDC_CONSTANT_MACROS

    1.1K10发布于 2018-12-14
  • 来自专栏韩曙亮的移动开发专栏

    【Android 高性能音频】Oboe 开发流程 ( 创建并设置 AudioStreamCallback 对象 | 打开 Oboe 音频流 | 日志封装 logging_macros.h )

    Result: OK 三、日志封装 ---- Google 中提供了一个很好的 log 封装头文件 , logging_macros.h , 很多官方示例中都使用这个头文件 ; #ifndef __SAMPLE_ANDROID_DEBUG_H

    74000编辑于 2023-03-28
  • 来自专栏C++核心准则原文翻译

    C++核心准则ES.33:如果必须使用宏定义,命名要有唯一性

    ES.33: If you must use macros, give them unique names ES.33:如果必须使用宏定义,命名要有唯一性 Reason(原因) Macros do not else's MYCHAR*/ #define ZCORP_CHAR /* Still evil, but less likely to clash */ Note(注意) Avoid macros However, there are billions of lines of code littered with macros and a long tradition for using and overusing macros. If you are forced to use macros, use long names and supposedly unique prefixes (e.g., your organization's

    30550发布于 2020-05-20
  • 来自专栏嵌入式项目开发

    windows下在QT里调用ffmpeg库处理音频视频数据时,出现error missing -D__STDC_FORMAT_MACROS 错误的解决方法(MINGW32编译器)。

    / #define __STDC_FORMAT_MACROS #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS //common.h中的错误 #define __STDC_FORMAT_MACROS //timestamp.h中的错误 #endif

    3K30编辑于 2022-01-12
  • 来自专栏C++核心准则原文翻译

    C++核心准则ES.31:不要用宏定义常量或函数​

    ES.31: Don't use macros for constants or "functions" ES.31:不要用宏定义常量或函数 Reason(原因) Macros are a major Macros don't obey the usual scope and type rules. Macros don't obey the usual rules for argument passing. Macros ensure that the human reader sees something different from what the compiler sees. Macros complicate tool building. 宏是错误的主要来源之一。宏不会遵守通常的范围和类型准则。宏也不会遵守参数传递准则。宏为人提供一个和编译器视角有些不同的视角。

    43330发布于 2020-05-20
  • 来自专栏Postgresql源码分析

    Postgresql中的C/C++混编(JIT)

    -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -DBUILD_EXAMPLES -I/data02/mingjie/bin -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -DBUILD_EXAMPLES -I/data02/mingjie/bin -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -DBUILD_EXAMPLES -I/data02/mingjie/bin -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -DBUILD_EXAMPLES -I/data02/mingjie/bin -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -DBUILD_EXAMPLES -I/data02/mingjie/bin

    50930编辑于 2023-10-13
  • 来自专栏iOS 备忘录

    Xcode 创建项目默认说明修改

    --more-->Kodeco文件自定义的说明如下:图片实现通过Customize text macros和Text macros reference可以看出,Xcode默认头部文字注释默认定义如下:/ FULLUSERNAME___ on ___DATE___.// ___COPYRIGHT___//然后参考Customizing the file header comment and other text macros in Xcode 9可以确定修改的步骤是:创建IDETemplateMacros.plist添加或修改Root对应的type为Dictionary然后参考Text macros reference中字段的含义 by 的用户名,又不想修改电脑用户名(可能会有风险),就可以通过最后一种方式修改,如下:图片参考Customizing the file header comment and other text macros in Xcode 9Customize text macrosText macros reference

    99720编辑于 2023-04-06
  • 来自专栏C++核心准则原文翻译

    C++核心准则ES.30: 不要使用宏进行程序中的文本操作​

    ES.30: Don't use macros for program text manipulation ES.30: 不要使用宏进行程序中的文本操作 Reason(原因) Macros are Macros don't obey the usual scope and type rules. Macros ensure that the human reader sees something different from what the compiler sees. Often the desire to use fancy macros is a sign of an overly complex design. Also, # and ## encourages the definition and use of macros: 本规则也不鼓励使用#和##进行字符串的转换和链接。

    85810发布于 2020-05-20
领券