0

私は現在 Itcl 言語 (tcl 言語に基づく) を学習しており、次のスクリプトを作成しました。
スクリプトは、4 つのパラメーターを取得し、それらをクラスのインスタンスのプライベート変数内に格納するドライバーを実装しています。

#!/bin/tclsh

package require Itcl

itcl::class driver {

    # private variables
    private variable bundle_id ""
    private variable scope ""
    private variable isSimulationModel ""
    private variable isX ""


    private method set_data_field {data_field_flag data_value} {
        switch -- $data_field_flag {
            -bundle {
                set bundle_id $data_value
                catch {unset bundle_id} 
                return
            }
            -scope {
                set scope $data_value
                catch {unset scope} 
                return
            }
            -isSimulationModel {
                set isSimulationModel $data_value
                catch {unset isSimulationModel} 
                return
            }
            -isX{
                set isX $data_value
                catch {unset isX} 
                return
            }
        }
        return
    }


    constructor {bundle hdl_path is_simulation_model is_x} {
        set_data_field -bundle $bundle
        set_data_field -scope $hdl_path
        set_data_field -isSimulationModel $is_simulation_model
        set_data_field -isX $is_x
 }

    destructor {}




} #* _DRIVER_ * #


driver d 1 2 3 4

実行しようとすると、次のエラーが発生します。

wrong # args: should be "itcl::class name { definition }"
while executing "itcl::class driver {

    # private variables
    private variable bundle_id ""
    private variable scope ""
    private variable isSimulationModel ""
    private v..."
(file "./driver.itcl" line 5)

誰かが私を助けて、このエラーが発生しているという私が間違っていたことを教えてもらえますか?

4

1 に答える 1