LoginSignup
0
1

More than 3 years have passed since last update.

シールド言語上でのusingとimportの違い

Last updated at Posted at 2020-02-11

シールド言語上でのusingとimportの違い

using->既にリンクされているもの。
import->リンクされていないもの。

ex.shie
using Sys
using Os
using Collection

<-標準モジュールはusing

ex.shie
import WindowsAPI
import ABC

<-非標準モジュール(サードパーティー製や自作モジュール)はimport

ex.udml
※Opening HTTP->MARK-UP->UDML
Call Protocol->Start
[module1](WindowsAPI.so)
[module2](MyShield\ABC.a)
[module3](MyShield\MyLib.so)
define Entry EntryPoint eq ex->Start-Up->Main @exだとグローバル空間から開始。_だと任意の一文字に当たるため無効。_を書きたいときは-と書く必要がある。
define Link Linking eq (module1,module2,module3)
out of !My-Shield-File.jcp where #Entry #Link open build 'ex.shie'
T set call scan 出来上がりました。もう一度コンパイルしますか?'Yes'-or-'No'
T eq yes get File->Open Me get Nil
ecro 終了です。ありがとうございました。
sys set Call Protocol->Quit 
※Closeing
Call sys->End
ex.shie
using WindowsAPI
using ABC
using MyLib
using Genelic
using 
from Sys using static Console
cdef square(x):
    #コンパイル時定関数(メンバーにすることも可能)
    return x*x 

cpdef Fun():
    #インライン関数get,setも実は中身はpub cpdef Get_XXX(value T),pub cpdef Set_XXX():
    return float(Input("数字を入力")) 

def Max<cdef T>(A T,B T) T Where T(self) and T(is not Null):
    #cdefはコンパイル時ジェネリクスでも使う。
    return if(A > B) A else B

def Min<T>(A T,B T) T Where T(self) and T(is not Null):
    #実行時ジェネリクスにdefは不要。
    return if(A < B) A else B

static class Start_Up(Unit):
    def Main():
        Output(square(6))
        Output("数値は"+str(Fun())+"です")
        #処理

<-この場合ex.udmlがないとコンパイル不可。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1