« UJMLサンプル107:変数のスコープの話 | メイン | 「UIEngine的やってはならない」をそろそろまとめよう »

UJMLサンプル108:importとexportの話とstate-machine そろそろまじめに学ばないとわからない(2006/05/05)

0_hatena_4 既存のソースコードをリファクタリングしていたら、予想外の動作で困り果てる。そろそろまじめに、<partition>や<state-machine>の勉強をしないとはまる。

 例えば、main.ujmlがこんな感じで、Hogeという名のステートマシンを使っているとする。このステートマシンから、_link()でnewPart.ujbcという新しい<partition>にリンクしているのだが、ランタイムエラーが発生する。「newPart.ujbcがsHogeのimportに失敗する」というエラーだ。ステートマシン内から_link()してはいけないのだろうか?どうなっているのか知りたい。

----

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ujml PUBLIC "-//UIEVOLUTION//DTD UJML 1.5//EN"
"http://www.uievolution.com/dtd/ujml-1.5.dtd" [
]>
<!-- http://uiengineda.blogs.com  -->
<ujml>
    <application>
        <state-machines>
            <state-machine name="Hoge">
                <state-variables>
                    <state-var name="sHoge" type="boolean" access="export"/>
                </state-variables>
                <functions>
                    <function name="go" type="void" visibility="public">
                        <script>
                            _link("test","build/newPart.ujbc");
                        </script>
                    </function>
                </functions>
            </state-machine>
        </state-machines>
        <script>
            Hoge.go();
        </script>
    </application>
</ujml>

----

----newPart.ujml

<ujml>
    <partition>
        <state-variables>
            <state-var name="sHoge" type="boolean" access="import"/>
        </state-variables>
        <script>
        </script>
    </partition>
</ujml>

----

トラックバック

この記事のトラックバックURL:
https://www.typepad.com/services/trackback/6a00d8341c2e2e53ef00e5506f940f8833

UJMLサンプル108:importとexportの話とstate-machine そろそろまじめに学ばないとわからないを参照しているブログ:

» UJMLサンプル112:importとexportの話とstate-machine ステートマシンの中からexportは駄目? (UIEngine だ)
 前回サンプル108で取り上げた問題は、state-machineエレメント内のものをexportするのではなく、state-machineごとexportすべし!ということで解決。 ソースコードはこちら:Download 112_main.ujml Download 112_newPart.ujml ... [続きを読む]

コメント

この記事へのコメントは終了しました。