Swift part13 (412レス)
上下前次1-新
抽出解除 レス栞
402(2): デフォルトの名無しさん (ワッチョイ 0bcd-JxoL) [sage] 2025/06/10(火) 22:15:58.52 ID:povNpgQm0(1) AAS
>Swift is a statically dispatched programming language.
>This results in Swift using memory addresses as much as possible when it needs to call a function.
>The side effect is the inability to capture the called function name, since in most of the cases it will be a simple memory address.
403: デフォルトの名無しさん (ワッチョイ fb08-G4JC) [] 2025/06/10(火) 22:48:21.96 ID:co9N3dhx0(4/4) AAS
>>402
ありがとう
ディクショナリー化して逃げることにします
404(1): デフォルトの名無しさん (ワッチョイ eb01-v8wM) [sage] 2025/06/10(火) 23:17:17.93 ID:HzGLhqs50(1) AAS
>>399399(1): デフォルトの名無しさん (ワッチョイ fb08-G4JC) [] 2025/06/10(火) 21:15:44.74 ID:co9N3dhx0(2/4) AAS
private test_func_name: String!
func test_func(function: () -> Void) -> String {
function()
let test: String = test_func_name
return(test)
}
func test_func1() -> Void {
test_func_name = #function
return()
}
func test_func2() -> Void {
test_func_name = #function
return()
}
print(test_func(function: test_func1())) //test_func1 出力
print(test_func(function: test_func2())) //test_func2 出力
--
>>398
> test_func(function: test_func1, name: “test_func1”)
これって、スペルミスしやすいですよね
上記の方が、まだマシな気はします
根本的に
関数の引数に関数を指定した場合、引数の関数名を取得
は不可ってことでしょうか
>これって、スペルミスしやすいですよね
だからマクロ・・・・・
>>402
@objc属性つければ事情が変わる
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.936s*