Macros are a power feature in a number of programming languages that make the language more extensible. Swift has always sought to enable expressive libraries through its use of type inference, generics, and general approach toward clarity of use. Macros in Swift are intended to improve expressiveness without sacrificing clarity.
This gist provides a "dashboard" with links to the various documents and example projects that are part of the Swift Macros effort. Head on over to the Swift Forums if you have questions!
Overview and examples:
- Macros vision document: lays out the overall motivation, goals, and approach we're taking in the implementation of macros in Swift.
- Example macros repository: contains a number of example macros that demonstrate the capabilities of the macro system and how it integrates into the language. This
As Swift evolves, it gains new language features and capabilities. There are different categories of features: some fill in gaps, taking existing syntax that is not permitted and giving it a semantics that fit well with the existing language, with features like conditional conformance or allowing existential values for protocols with Self
or associated type requirements. Others introduce new capabilities or paradigms to the language, such as the addition of concurrency or comprehensive reflection.
There is another large category of language features that provide syntactic sugar to eliminate common boilerplate, taking something that can be written out in long-form and making it more concise. Such features don't technically add any expressive power to the language, because you can always write the long-form version, but their effect can be transformational if it enables use cases that would otherwise have been unwieldy. The synthesis of Codable
conformances, for ex
##### 使用说明 ##### | |
# 1. 请填写 proxy-providers - subscribe - url 为订阅链接 | |
# 2. 下载 https://github.com/Loyalsoldier/clash-rules/archive/refs/heads/release.zip 并解压至 ./profiles/ruleset 文件夹下 | |
# 3. 若需要自动更新 ruleset, 请编辑 rule-providers-config - type 为 http | |
##### 参考链接 ##### | |
# 1. clash 样例配置文件 | |
# https://lancellc.gitbook.io/clash/clash-config-file/an-example-configuration-file | |
# 2. clash 规则集 | |
# https://github.com/Loyalsoldier/clash-rules |
Tested on macOS:
- Install the CodeLLDB VSCode extension. Unlike the debugger in the C/C++ extension, this allows to set breakpoints inside Zig "test" blocks (in the MS C/C++ extension debugger, breakpoints inside test blocks will be disabled once the debugger starts for unknown reasons.
- When compiling the test, tell it to also emit a binary:
zig test -femit-bin=zig-out/bin/my-test src/bla.zig
, otherwise there will be no executable to debug. - The compiled test executable expects the path to the Zig executable as first command line argument, the launch.json file
needs to be setup accordingly (note the
args
item):
import Combine | |
import CoreFoundation | |
import CoreGraphics | |
import CoreText | |
import Darwin | |
import Foundation | |
import SwiftUI | |
import UIKit | |
import os.log | |
import os |
键盘,可以算是最传统的输入设备之一。在计算机尚未诞生时,就已被广泛地用在打字机上。即使是在交互方式不断突破的今天,没人能够否认,传统的键盘依然处在人机交互的中心地位。我们使用电脑的绝大部分时间都是在敲击键盘中度过的,键盘使用的熟练度和舒适度直接影响着工作效率。因此,了解、熟练使用、甚至根据个体需求改造键盘,往往能够极大的提升工作效率。在本文中,笔者将将结合自己的使用经验,探讨一些能够提升 macOS 系统的键盘使用效率的方法与技巧。
几乎所有对 macOS 系统有一定了解的用户都知道,macOS 的系统快捷键是以 Command (⌘) 为中心的。实际上,Control 键和 Option 键也暗藏不少秘密。
Author: Chris Lattner