包み込んでいるコンパイルされた関数についての情報を与える.
CurrentCompiledFunctionData[prop]
包み込んでいるコンパイルされた関数の型特性 prop の値を与える.
CurrentCompiledFunctionData
包み込んでいるコンパイルされた関数についての情報を与える.
CurrentCompiledFunctionData[prop]
包み込んでいるコンパイルされた関数の型特性 prop の値を与える.
詳細
- CurrentCompiledFunctionDataはコンパイルされたコードでしか使えない.
- CurrentCompiledFunctionDataへの呼び出しから返される名前はFunctionDeclarationで設定されたものである.
- CurrentCompiledFunctionData["ReturnType"]は,関数の戻り型にアクセスする便利な方法である.
- CurrentCompiledFunctionDataへの呼出しは型"CompiledFunctionData"の結果を返す.
- CurrentCompiledFunctionDataへの呼出しには包み込んでいる関数の型が含まれているので,これを関数から返すことはできない.
- 次は,サポートされる特性である.
-
"Type" 包み込んでいる関数の型 "ReturnType" 包み込んでいる関数の戻り型
例題
すべて開く すべて閉じる例 (2)
現行関数についての情報を出力する関数をコンパイルして評価する:
comp = FunctionCompile[Function[Typed[arg, "Integer64"], Echo[CurrentCompiledFunctionData[]]; {arg}]];
comp[10]comp = FunctionCompile[Function[Typed[arg, "Integer64"], Echo[CurrentCompiledFunctionData["Type"]]; {arg}]];
comp[10]comp = FunctionCompile[Function[Typed[arg, "Integer64"], Echo[CurrentCompiledFunctionData["ReturnType"]]; {arg}]];
comp[10]名前付きの関数にCurrentCompiledFunctionDataが出現する場合は以下が含まれる:
decl = FunctionDeclaration[DemoFunc, Typed[{"Integer64"} -> "PackedArray"::["Integer64", 1]]@Function[{arg}, Echo[CurrentCompiledFunctionData[]];{arg}]];comp = FunctionCompile[decl, Function[Typed[arg, "Integer64"], DemoFunc[arg]]];
comp[10]スコープ (3)
CurrentCompiledFunctionDataはコンパイルされたコードでしか使えない:
CurrentCompiledFunctionData[]decl = FunctionDeclaration[makeZero, Typed[ForAllType[e, {} -> e]]@Function[{}, TypeHint[0, CurrentCompiledFunctionData["ReturnType"]]]];comp = FunctionCompile[decl, Function[Typed[arg, "Integer64"], TypeHint[makeZero[], TypeOf[arg]]]];
Information[comp, "Type"]comp = FunctionCompile[decl, Function[Typed[arg, "Real64"], TypeHint[makeZero[], TypeOf[arg]]]];
Information[comp, "Type"]CurrentCompiledFunctionDataの結果は,名前等の情報が抽出できる関数に渡すことができる:
decls = {
FunctionDeclaration[printName, Typed[ForAllType[funTy, {"CompiledFunctionData"::[funTy]} -> "Null"]]@Function[{arg}, Print[arg["Name"]]]
]
,
FunctionDeclaration[functionName["MyFunction"],
Typed[{} -> "Null"]@
Function[{}, printName[CurrentCompiledFunctionData[]]]
]};以下はCurrentCompiledFunctionDataが出現する関数の名前を出力する:
comp = FunctionCompile[decls, Function[{}, functionName["MyFunction"][]]];
comp[]考えられる問題 (1)
CurrentCompiledFunctionDataへの呼出しの結果は,関数から返すことはできない:
FunctionCompile[Function[{}, CurrentCompiledFunctionData[]]]CurrentCompiledFunctionData[]が"InertExpression"にキャストされるとコンパイルが成功する:
cf = FunctionCompile[Function[{}, Cast[CurrentCompiledFunctionData[], "InertExpression"]]][]これが呼ばれると,結果のCompiledFunctionDataオブジェクトは戻り型が"InertExpression"であることを示す:
cf[]テクニカルノート
関連するガイド
テキスト
Wolfram Research (2025), CurrentCompiledFunctionData, Wolfram言語関数, https://reference.wolfram.com/language/ref/CurrentCompiledFunctionData.html.
CMS
Wolfram Language. 2025. "CurrentCompiledFunctionData." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CurrentCompiledFunctionData.html.
APA
Wolfram Language. (2025). CurrentCompiledFunctionData. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CurrentCompiledFunctionData.html
BibTeX
@misc{reference.wolfram_2026_currentcompiledfunctiondata, author="Wolfram Research", title="{CurrentCompiledFunctionData}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/CurrentCompiledFunctionData.html}", note=[Accessed: 12-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_currentcompiledfunctiondata, organization={Wolfram Research}, title={CurrentCompiledFunctionData}, year={2025}, url={https://reference.wolfram.com/language/ref/CurrentCompiledFunctionData.html}, note=[Accessed: 12-September-2026]}