1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

自作コンパイル言語「Mute」開発記 #2

1
Posted at

こんにちは!noi_nekoです!
今回は追加で制定した構文を書いていきたいと思います

変更点

変更点変更点は2点あります

1. メモリの共有性

メモリの共有性はブロック関数または型が変更された時に変数がわも一定期間ではなくそのものが変えられます。
例:

Mute main.mt
int x = 60; // この時点で型はi64[2]
print((x as String)!) // ここでString[2]になったら元のxも変更される
print((!typeof the x)) // String[2]

2. Pandra

MuteはC++で開発しますだからこそ実現できる(?)タイプがあります。それがPandraです
PandraはRustのように所有権を持ち、完全に隔離されたメモリの箱(RustでいうBoxです)を作ることができるタイプです。
例を示すと、

Mute main.mt
Pandra x;
(!put 64, max_stack)
print(x.max_stack) //これはパスされる
// でも
fn demo() {
    (!put "demon", demo)
    // err: access denided
}
demo() //ここでerr

のようにアクセスできません。
rustのようにメモリ上の移動はない。

今回はこのくらいにしておこうと思います

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?