SkillAgentSearch skills...

TemporaryVariable

`TemporaryVariable` provide a macro `#info {...}`. It capture most function calls and assign them to temporary variables.

Install / Use

/learn @yume190/TemporaryVariable
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

TemporaryVariable


TemporaryVariable provide a macro #info {...}. It capture most function calls and assign them to temporary variables.

Usage

Most of the time we will write the following code.

func test() -> Int {
    return x()
}

Usually we need a temporary variable to facilitate our debugging

func test() -> Int {
    let result = x()
    return result
}

Now. You can use #info {...}

import TemporaryVariable
func test() -> Int {
    #info {
        return x()
    }
}

The expanded code

import TemporaryVariable
// public func info<T>(_ closure: () -> T) -> T {
//     return closure()
// }

func test() -> Int {
    info {
        let __macro_local_7result0fMu_ = x()
        return __macro_local_7result0fMu_
    }
}
View on GitHub
GitHub Stars7
CategoryDevelopment
Updated1y ago
Forks1

Languages

Swift

Security Score

75/100

Audited on Jun 14, 2024

No findings